Repository navigation
Description
Problem
agent-framework-hosting-a2a cannot emit Agent Framework text as a native A2A text part with an explicitly selected concrete media type, such as text/markdown, through the built-in conversion helper.
This is a feature/design request separate from #10351. Recognizing text/plain and text/* as generic text modes does not decide whether an advertised concrete format should also authorize labeling otherwise unspecified agent text with that format. The current package guidance deliberately leaves custom output conversion to the application.
Use Case and Evidence
Consider an application whose agent already produces Markdown and whose A2A card advertises only text/markdown. The application needs to preserve that format in the outgoing part; it does not need the helper to generate or reformat Markdown.
Minimal reproduction:
from agent_framework import Message
from agent_framework_hosting_a2a import a2a_from_run
response = Message("assistant", ["# Hello"])
a2a_from_run(response, output_modes=["text/markdown"])Observed:
ValueError: Agent Framework text output cannot be converted to the advertised A2A modes: ['text/markdown'].
Reproduced by Codex on Windows with Python 3.13.2 and a2a-sdk 1.2.3, using the local source checkout based on main commit 92838b604 plus the candidate fix for #10351. This concrete-output limitation is intentionally retained by that candidate.
Related draft PR: #10362
Desired Outcome
Provide a documented, explicit way for an application that knows its output format to obtain Part(text="# Hello", media_type="text/markdown") through the conversion helper or adapter, while validating it against the advertised output modes.
The helper should preserve the supplied text rather than invent, transform, or claim to validate its format.
Alternatives Considered
- Build native A2A
Partvalues in application-owned conversion code. This works today but means bypassing or supplementing the built-in output helper. - Advertise generic text modes. This permits text conversion but does not express the application's intended concrete output format.
- Automatically select any advertised
text/<subtype>. This needs an explicit policy, especially when several concrete text formats are advertised; the card alone may be insufficient evidence of a particular response's format.
Proposed Direction
Please clarify whether concrete output-format selection belongs in the helper/adapter contract. Potential approaches for discussion are preserving an explicitly supplied content media type or adding an opt-in output media type to conversion. Treating a single advertised concrete text mode as sufficient is another option, but should be an intentional maintainer decision.
If supported, define how explicit selection interacts with multiple advertised text modes, JSON fallback, completed responses, streaming agent updates, and workflow outputs.
Scope and Non-Goals
- Keep this separate from the generic text-mode aliases in Python: [Bug]: hosting-a2a rejects plain text when the advertised modes use MIME types such as text/plain or text/* #10351.
- Do not add Markdown rendering, format inference, or content validation.
- Do not change default card modes.
- MIME parameter matching and new metadata conventions are outside this request.
- No implementation of this feature is included in the related draft PR.
Language
Python
Contribution Intent
I am only requesting the feature.
Acknowledgements
- I searched existing issues and did not find a duplicate.
- I will wait for explicit maintainer agreement before starting implementation of a non-trivial change.
AI Assistance
Codex assisted with the investigation, ran the local reproduction above, and prepared this feature request. No human execution of the reproduction is claimed.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity