Python: Upgrade hosting server dependency and add more type support#5459
Conversation
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Pull request overview
Updates the Foundry Hosting Responses server integration to align with newer azure-ai-agentserver-* dependencies and expand request input type handling (beyond plain text), with added/updated unit tests to cover the new conversions and multi-turn/mixed-content scenarios.
Changes:
- Bump
azure-ai-agentserver-core/responses/invocationsdependency versions and update Foundry Hosting package version. - Update Responses hosting to convert
ResponseContextinput items intoagent_framework.Messageobjects (supporting mixed content / more item types). - Expand test coverage for input/output item conversion and multi-turn flows with mixed content.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| python/uv.lock | Locks updated versions of azure-ai-agentserver-* packages and Foundry Hosting package version. |
| python/packages/foundry_hosting/pyproject.toml | Pins Foundry Hosting dependencies to the newer azure-ai-agentserver-* betas and bumps package version. |
| python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py | Switches request handling to use get_input_items() and adds conversion logic for more input Item types. |
| python/packages/foundry_hosting/tests/test_responses.py | Refactors/extends tests for output item conversion and adds comprehensive tests for input item conversion and mixed-content multi-turn behavior. |
There was a problem hiding this comment.
Automated Code Review
Reviewers: 4 | Confidence: 90%
✓ Correctness
This PR replaces
get_input_text()withget_input_items()plus a new_items_to_messages()conversion layer, enabling the host to receive rich input (images, files, function calls, etc.) instead of just plain text. A new_item_to_message()function mirrors the existing_output_item_to_message()for inputItemtypes. The existing functions are cleanly renamed with an_output_prefix. The change is well-tested with comprehensive unit tests and multi-turn integration tests. No correctness bugs found. One minor docstring inaccuracy exists but is not a functional issue.
✓ Security Reliability
This PR refactors input handling from plain text (get_input_text) to structured items (get_input_items), adding a new _item_to_message conversion function that mirrors the existing _output_item_to_message pattern. Dependency versions are bumped for azure-ai-agentserver packages. The new code uses the same defensive patterns as existing code: type-checking via item.type before casting, raising ValueError for unsupported types, and coercing non-string outputs to strings. No injection risks, unsafe deserialization, secret leaks, resource leaks, or unhandled failure modes were found. The extensive new test suite covers all item types including edge cases (non-string outputs, missing summaries, unsupported types).
✓ Test Coverage
The PR adds a new
_item_to_messagefunction with 22+ item-type branches and renames_to_message→_output_item_to_message. Test coverage is thorough: every branch of_item_to_messagehas a dedicated unit test inTestItemToMessage, edge cases like non-string output coercion are tested, and 13 multi-turn integration tests inTestMultiTurnMixedContentexercise the full HTTP→conversion→agent pipeline for mixed content types, streaming, and multi-turn history. The only notable gap is that the identical_items_to_messageschange in_handle_workflow_agenthas no integration test (only the_handle_regular_agentpath is exercised), and theinput_filewithfile_idpath in_convert_message_contentlacks a test. Neither gap is blocking given the shared code paths.
✗ Design Approach
The change correctly fixes the immediate inability to accept non-string
input, but it does so at the hosting layer in a way that assumes every non-workflow agent in this repo can consume structuredMessage.contents. That assumption does not hold: several concrete agents still flatten prompts tomessage.textor reject non-text entirely, so this broadItem-to-Messageforwarding will silently drop images/tool state or fail for common agents. I would request changes so the feature is capability-gated or scoped to agents that actually preserve structured content end-to-end.
Flagged Issues
- The new regular-agent path forwards arbitrary
Iteminputs as richMessageobjects to every agent implementation, but multiple in-repo agents are text-only (Claude flattens via_format_prompt(), GitHub Copilot and Copilot Studio joinmessage.text, DurableTask rejects non-text outright). The design needs capability gating or a text-only fallback instead of treating structured-item support as universal.
Suggestions
- Gate
_items_to_messages()behind an explicit 'structured content supported' capability or agent type check, and keep using text normalization for agents that only readmessage.textor explicitly reject non-text inputs. - The
input_filecontent type withfile_id(as opposed tofile_url) is not tested anywhere. A unit or integration test for{"type": "input_file", "file_id": "file-xyz"}would exercise theContent.from_hosted_file(file.file_id, name=file.filename)branch at line 858 of_responses.py.
Automated review by TaoChenOSU's agents
Previous commit incorrectly renamed the [1.1.1] header to [1.2.0], which wiped the historical 1.1.1 entries and wrongly attributed them to 1.2.0. This restores [1.1.1] to its origin/main content and adds a new [1.2.0] section above containing only the commits in python-1.1.1..HEAD: - microsoft#4238 functional workflow API - microsoft#5142 GitHub Copilot OpenTelemetry - microsoft#2403 A2A bridge support - microsoft#5070 oauth_consent_request events in Foundry clients - microsoft#5447 FoundryAgent hosted agent sessions - microsoft#5459 hosting server dependency upgrade + types - microsoft#5389 AG-UI reasoning/multimodal parsing fix - microsoft#5440 stop [TOOLBOXES] warning spam - microsoft#5455 user agent prefix fix Also corrects the [1.2.0] compare base to python-1.1.1 (not 1.1.0) and adds the missing [1.1.1] reference link.
* Bump Python package versions for 1.2.0 release Released tier bumps 1.1.1 -> 1.2.0 (core, openai, foundry, root) to reflect additive public APIs landed since 1.1.0: functional workflow API (#4238) and FunctionTool SKIP_PARSING sentinel (#5424). All beta packages stamped 1.0.0b260424, alpha packages 1.0.0a260424. All 26 non-core agent-framework-core floors raised to >=1.2.0,<2. CHANGELOG consolidates the never-tagged 1.1.1 entries with the post-merge additions into [1.2.0]. * Update CHANGELOG footer links for 1.2.0 Advance [Unreleased] comparison base from python-1.1.0 to python-1.2.0 and add a [1.2.0] reference link comparing python-1.1.0...python-1.2.0 so the heading links resolve correctly. * Fix CHANGELOG: restore [1.1.1] section and add proper [1.2.0] Previous commit incorrectly renamed the [1.1.1] header to [1.2.0], which wiped the historical 1.1.1 entries and wrongly attributed them to 1.2.0. This restores [1.1.1] to its origin/main content and adds a new [1.2.0] section above containing only the commits in python-1.1.1..HEAD: - #4238 functional workflow API - #5142 GitHub Copilot OpenTelemetry - #2403 A2A bridge support - #5070 oauth_consent_request events in Foundry clients - #5447 FoundryAgent hosted agent sessions - #5459 hosting server dependency upgrade + types - #5389 AG-UI reasoning/multimodal parsing fix - #5440 stop [TOOLBOXES] warning spam - #5455 user agent prefix fix Also corrects the [1.2.0] compare base to python-1.1.1 (not 1.1.0) and adds the missing [1.1.1] reference link.
Motivation and Context
Upgrade to the latest hosting packages that contain bug fixes. Also add more type support.
Contribution Checklist