Skip to content

Python: Upgrade hosting server dependency and add more type support#5459

Merged
eavanvalkenburg merged 2 commits intomainfrom
feature/upgrade-hosting-dep-and-add-more-type-support
Apr 24, 2026
Merged

Python: Upgrade hosting server dependency and add more type support#5459
eavanvalkenburg merged 2 commits intomainfrom
feature/upgrade-hosting-dep-and-add-more-type-support

Conversation

@TaoChenOSU
Copy link
Copy Markdown
Contributor

@TaoChenOSU TaoChenOSU commented Apr 24, 2026

Motivation and Context

Upgrade to the latest hosting packages that contain bug fixes. Also add more type support.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@TaoChenOSU TaoChenOSU self-assigned this Apr 24, 2026
Copilot AI review requested due to automatic review settings April 24, 2026 00:34
@github-actions github-actions Bot changed the title Upgrade hosting server dependency and add more type support Python: Upgrade hosting server dependency and add more type support Apr 24, 2026
@TaoChenOSU TaoChenOSU marked this pull request as ready for review April 24, 2026 00:36
@moonbox3
Copy link
Copy Markdown
Contributor

moonbox3 commented Apr 24, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/foundry_hosting/agent_framework_foundry_hosting
   _responses.py51912376%150–151, 160–161, 165, 170, 189, 219–221, 236–238, 249–251, 270–271, 273, 275–277, 279–281, 285–288, 291–296, 303, 308, 311, 317–318, 320–321, 323, 325, 327–330, 332–334, 337, 341, 343–350, 353–354, 356–358, 366–371, 443–444, 549–550, 1089–1091, 1093, 1115–1116, 1118–1119, 1121–1122, 1124–1125, 1136–1140, 1142, 1160, 1163, 1198–1202, 1206–1212, 1219–1223, 1229–1235, 1242, 1248, 1251
TOTAL29173344988% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
5846 30 💤 0 ❌ 0 🔥 1m 32s ⏱️

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/invocations dependency versions and update Foundry Hosting package version.
  • Update Responses hosting to convert ResponseContext input items into agent_framework.Message objects (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.

Comment thread python/packages/foundry_hosting/agent_framework_foundry_hosting/_responses.py Outdated
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated Code Review

Reviewers: 4 | Confidence: 90%

✓ Correctness

This PR replaces get_input_text() with get_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 input Item types. 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_message function with 22+ item-type branches and renames _to_message_output_item_to_message. Test coverage is thorough: every branch of _item_to_message has a dedicated unit test in TestItemToMessage, edge cases like non-string output coercion are tested, and 13 multi-turn integration tests in TestMultiTurnMixedContent exercise 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_messages change in _handle_workflow_agent has no integration test (only the _handle_regular_agent path is exercised), and the input_file with file_id path in _convert_message_content lacks 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 structured Message.contents. That assumption does not hold: several concrete agents still flatten prompts to message.text or reject non-text entirely, so this broad Item-to-Message forwarding 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 Item inputs as rich Message objects to every agent implementation, but multiple in-repo agents are text-only (Claude flattens via _format_prompt(), GitHub Copilot and Copilot Studio join message.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 read message.text or explicitly reject non-text inputs.
  • The input_file content type with file_id (as opposed to file_url) is not tested anywhere. A unit or integration test for {"type": "input_file", "file_id": "file-xyz"} would exercise the Content.from_hosted_file(file.file_id, name=file.filename) branch at line 858 of _responses.py.

Automated review by TaoChenOSU's agents

@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Apr 24, 2026
Merged via the queue into main with commit 4adfd24 Apr 24, 2026
32 checks passed
moonbox3 added a commit to moonbox3/agent-framework that referenced this pull request Apr 24, 2026
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.
moonbox3 added a commit that referenced this pull request Apr 24, 2026
* 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants