Python: Fix AG-UI url source dropping attachments when the URL is in source.value - #7655
Open
Atharva Vichare (atty57) wants to merge 1 commit into
Open
Python: Fix AG-UI url source dropping attachments when the URL is in source.value#7655Atharva Vichare (atty57) wants to merge 1 commit into
Atharva Vichare (atty57) wants to merge 1 commit into
Conversation
…source.value The ag-ui-protocol `InputContentUrlSource` carries the URL in `source.value`, but `_extract_multimodal_source_fields` only read `source.url`/`source.uri` for url-typed sources, so attachments sent in the spec shape were dropped during the AG-UI to MAF conversion. The base64 branch already read `source.value` correctly. Read `source.value` first, keeping `url`/`uri` as fallbacks for the non-spec shape. Adds tests for both. Fixes microsoft#7653
Atharva Vichare (atty57)
deployed
to
github-app-auth
August 13, 2026 18:25 — with
GitHub Actions
Active
Atharva Vichare (atty57)
deployed
to
github-app-auth
August 13, 2026 18:25 — with
GitHub Actions
Active
Atharva Vichare (atty57)
deployed
to
github-app-auth
August 13, 2026 18:25 — with
GitHub Actions
Active
Atharva Vichare (atty57)
deployed
to
github-app-auth
August 13, 2026 18:26 — with
GitHub Actions
Active
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes AG-UI attachment conversion by recognizing spec-compliant URLs in source.value.
Changes:
- Prioritizes
source.valuefor URL sources while preserving legacy fallbacks. - Adds tests for spec and legacy URL shapes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
python/packages/ag-ui/agent_framework_ag_ui/_message_adapters.py |
Extracts URLs from spec-compliant sources. |
python/packages/ag-ui/tests/ag_ui/test_message_adapters.py |
Covers current and legacy URL fields. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Evan Mattson (moonbox3)
approved these changes
Aug 14, 2026
Evan Mattson (moonbox3)
enabled auto-merge
August 14, 2026 05:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
The ag-ui-protocol spec puts the URL of a url-typed source in
source.value(InputContentUrlSource.value), not insource.url._extract_multimodal_source_fieldsin the AG-UI message adapter only readsource.url/source.urifor url-typed sources, so_parse_multimodal_media_partreturnedNoneand every attachment sent in the spec shape was silently dropped during the AG-UI → MAF conversion. Applications following the current AG-UI spec could not send file attachments at all.The base64 branch immediately below already read
source.valuecorrectly, so the two branches disagreed about where the payload lives.Description & Review Guide
What are the major changes?
_extract_multimodal_source_fieldsnow readssource.valuefirst for url-typed sources, keepingsource.url/source.urias fallbacks.{"type": "url", "value": ...}) and the non-specurl/urishape, so the backward-compatible path stays covered.What is the impact of these changes?
urlform and the non-specsource.urlform both still resolve, andsource.valueonly wins when it is present. Not a breaking change.Content.from_uri(...)instead of being dropped.What do you want reviewers to focus on?
valueshould also take precedence in the unknown-source.typefallback branch. I left that branch alone: therevaluecurrently feedsdata, and changing it would alter behavior for source types outside the spec. The spec only definesdataandurlsources, both usingvalue, and both are now handled by their explicit branches.Verification:
uv run poe test -P ag-ui→ 962 passed. The reproduction from the issue now yields aContentwithuri == "https://example.com/files/document.pdf"andmedia_type == "application/pdf".Related Issue
Fixes #7653
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.