Skip to content

Python: [Bug]: A2A file part without media_type becomes "data:;base64,..." and can't be sent on #10250

Description

@nniiovoo

Observed Behavior

When a remote A2A agent returns a raw file part without media_type (it's optional in A2A), A2AAgent turns it into data content with the URI data:;base64,.... Passing that content on to another A2A agent then fails with ValueError: Invalid data URI format, because get_uri_data needs a media type. Serving it through A2AExecutor fails the same way.

Expected Behavior

The file can be passed on. A raw part with no media type could default to application/octet-stream, like the AG-UI message adapter already does.

Steps to Reproduce

  1. Have a remote A2A agent return a raw file part without media_type
  2. Run A2AAgent against it
  3. Send the returned content to another A2AAgent

Minimal Reproduction

import asyncio

from a2a.types import Artifact, Part, StreamResponse, Task, TaskState, TaskStatus
from agent_framework import Message

from agent_framework_a2a import A2AAgent


class FakeClient:
    """Remote A2A agent that returns a file part without media_type (it's optional in A2A)."""

    async def send_message(self, request):
        yield StreamResponse(
            task=Task(
                id="task-1",
                context_id="ctx",
                status=TaskStatus(state=TaskState.TASK_STATE_COMPLETED),
                artifacts=[Artifact(artifact_id="a1", parts=[Part(raw=b"%PDF-1.7 ...", filename="report.pdf")])],
            )
        )


async def main():
    response = await A2AAgent(name="remote", client=FakeClient()).run("make me a report")
    file = response.messages[0].contents[0]
    print("received:", file.uri)

    # Pass the file on to another A2A agent.
    await A2AAgent(name="other", client=FakeClient()).run(Message(role="user", contents=[file]))
    print("forwarded ok")


asyncio.run(main())

Error Messages and Stack Traces

received: data:;base64,JVBERi0xLjcgLi4u
Traceback (most recent call last):
  ...
  File ".../agent_framework_a2a/_agent.py", line 1269, in _prepare_message_for_a2a
  File ".../agent_framework_a2a/_utils.py", line 26, in get_uri_data
    raise ValueError(f"Invalid data URI format: {uri}")
ValueError: Invalid data URI format: data:;base64,JVBERi0xLjcgLi4u

Package Versions

agent-framework-core 1.25.0, agent-framework-a2a 1.0.0b261106 (main at fe87fdd), a2a-sdk 1.2.3

Python Version

Python 3.12

Operating System

macOS

Regression

No

Additional Context

The raw case in _parse_contents_from_a2a uses media_type=part.media_type or "". I have a fix with a test and will open a PR.

AI assistance: I used an AI assistant to help find the cause and write this up. I ran the repro myself.

Acknowledgements

  • I searched existing issues and did not find a duplicate.
  • I personally verified this behavior and the reproduction details are authentic.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Nov 10, 2026
  2. added
    a2aUsage: [Issues, PRs], Target: A2A
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Nov 10, 2026
  3. github-actions commented on Nov 10, 2026

    @github-actions
    Contributor

    Reproduced on main (fe87fdd) with an independently written fake-client test: a raw A2A part without media_type becomes (redacted) and forwarding it to another A2AAgent raises ValueError: Invalid data URI format (agent.py mediatype=part.media_type or "" → utils.geturi_data). Routed to the agent-framework-a2a` owner. Support boundary: unclear — no maintained spec/doc checked here establishes it; a maintainer should decide. Fix PR #10251 is open and not yet merged or released. Run: https://github.com/microsoft/agent-framework/actions/runs/42881732010

    Generated by Issue Routing for #10250 · copilot · auto · ~19 AIC · ⌖ ~1 AIC · ⊞ 5.2K · ◷

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

Metadata

Metadata

Labels

a2aUsage: [Issues, PRs], Target: A2ApythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflowtriageUsage: [Issues], Target: All issues that still need to be triaged

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions