Python: Upgrade agentserver packages (#5284)

* Upgrade agentserver packages

* Fix new types
This commit is contained in:
Tao Chen
2026-04-15 14:16:37 -07:00
committed by GitHub
Unverified
parent 9e3983e547
commit 3225a59fd3
4 changed files with 39 additions and 59 deletions
@@ -20,6 +20,10 @@ from azure.ai.agentserver.responses.models import (
ComputerScreenshotContent,
CreateResponse,
FunctionCallOutputItemParam,
FunctionShellAction,
FunctionShellCallOutputContent,
FunctionShellCallOutputExitOutcome,
LocalEnvironmentResource,
MessageContent,
MessageContentInputFileContent,
MessageContentInputImageContent,
@@ -89,17 +93,12 @@ class ResponsesHostServer(ResponsesAgentServerHost):
)
self._agent = agent
self.create_handler(self._handle_create) # pyright: ignore[reportUnknownMemberType]
self.response_handler(self._handler) # pyright: ignore[reportUnknownMemberType]
# Append the user agent prefix for telemetry purposes
append_to_user_agent(self.USER_AGENT_PREFIX)
self.create_handler(self._handle_create) # pyright: ignore[reportUnknownMemberType]
# Append the user agent prefix for telemetry purposes
append_to_user_agent(self.USER_AGENT_PREFIX)
async def _handle_create(
async def _handler(
self,
request: CreateResponse,
context: ResponseContext,
@@ -551,24 +550,26 @@ async def _to_outputs(stream: ResponseEventStream, content: Content) -> AsyncIte
async for event in stream.aoutput_item_custom_tool_call_output(content.call_id or "", output):
yield event
elif content.type == "shell_tool_call":
action: dict[str, Any] = {"type": "exec", "command": content.commands or []}
action = FunctionShellAction(commands=content.commands or [], timeout_ms=0, max_output_length=0)
async for event in stream.aoutput_item_function_shell_call(
content.call_id or "",
action,
{},
LocalEnvironmentResource(),
status=content.status or "completed",
):
yield event
elif content.type == "shell_tool_result":
output_items: list[dict[str, Any]] = []
output_items: list[FunctionShellCallOutputContent] = []
if content.outputs:
for out in content.outputs:
output_items.append({
"type": "shell_output",
"stdout": getattr(out, "stdout", "") or "",
"stderr": getattr(out, "stderr", "") or "",
"exit_code": getattr(out, "exit_code", None),
})
exit_code = getattr(out, "exit_code", None)
output_items.append(
FunctionShellCallOutputContent(
stdout=getattr(out, "stdout", "") or "",
stderr=getattr(out, "stderr", "") or "",
outcome=FunctionShellCallOutputExitOutcome(exit_code=exit_code if exit_code is not None else 0),
)
)
async for event in stream.aoutput_item_function_shell_call_output(
content.call_id or "",
output_items,
+3 -14
View File
@@ -24,22 +24,11 @@ classifiers = [
]
dependencies = [
"agent-framework-core>=1.0.0,<2",
"azure-ai-agentserver-core==2.0.0a20260414006",
"azure-ai-agentserver-responses==1.0.0a20260414006",
"azure-ai-agentserver-invocations==1.0.0a20260414006",
"azure-monitor-opentelemetry-exporter>=1.0.0a1"
"azure-ai-agentserver-core==2.0.0b1",
"azure-ai-agentserver-responses==1.0.0b1",
"azure-ai-agentserver-invocations==1.0.0b1",
]
[tool.uv.sources]
azure-ai-agentserver-responses = { index = "azure-sdk-for-python" }
azure-ai-agentserver-invocations = { index = "azure-sdk-for-python" }
azure-ai-agentserver-core = { index = "azure-sdk-for-python" }
azure-monitor-opentelemetry-exporter = { index = "azure-sdk-for-python" }
[[tool.uv.index]]
name = "azure-sdk-for-python"
url = "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-python/pypi/simple/"
[tool.uv]
prerelease = "if-necessary-or-explicit"
environments = [