Skip to content

Python: AG-UI chat client drops multimodal message content #8114

Description

@CoralGarden52

Description

The Python AGUIChatClient drops non-text content when serializing Agent Framework messages into AG-UI request messages.

In python/packages/ag-ui/agent_framework_ag_ui/_message_adapters.py, agent_framework_messages_to_agui currently handles text, function calls, and function results, but Content.from_uri() and Content.from_data() content is skipped. _client.py then sends the already-truncated message list to the HTTP service.

Reproduction

On the current main branch (26832bed1fa192febbb0ceec16d5a2900a39eb27), sending a normal user message through AGUIChatClient:

Message(
    role="user",
    message_id="user-1",
    contents=[
        Content.from_text("describe this"),
        Content.from_uri("https://example.com/cat.png", media_type="image/png"),
        Content.from_data(b"abc", media_type="image/png"),
    ],
)

produces this outbound request message:

{"id": "user-1", "role": "user", "content": "describe this"}

Both media items are absent. The same loss occurs through the public Agent -> AGUIChatClient -> HTTP path, before the request reaches the server. This was reproduced with an httpx.MockTransport, so no external model or service is involved.

Expected behavior

The client should preserve text and supported media content in their original order using AG-UI InputContent parts, for example:

{
  "role": "user",
  "content": [
    {"type": "text", "text": "describe this"},
    {
      "type": "image",
      "source": {
        "type": "url",
        "value": "https://example.com/cat.png",
        "mimeType": "image/png"
      }
    },
    {
      "type": "image",
      "source": {
        "type": "data",
        "value": "YWJj",
        "mimeType": "image/png"
      }
    }
  ]
}

AG-UI documents ordered multimodal input content for images, audio, video, and documents: https://docs.ag-ui.com/sdk/js/core/multimodal-inputs

Impact

Any Python Agent using AGUIChatClient to forward a multimodal user message to a stateless AG-UI server loses the media before the server can process it. This affects the regular client request path, not an exceptional or low-probability condition.

Proposed fix

  • Convert Agent Framework URI and data content to AG-UI InputContent parts.
  • Preserve the order of text and media parts.
  • Keep the existing text-only and tool-call behavior backward compatible.
  • Restrict InputContent lists to user messages because the AG-UI AssistantMessage content shape remains text-only.
  • Add adapter and request-level regression tests covering URL, base64 data, and mixed text/media input.

This concerns the outbound Agent Framework-to-AG-UI conversion. It is distinct from #8083, which addresses multimodal content during orchestrator handoff.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationpythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions