Skip to content

Python: [Feature]: Explicit concrete text output modes in hosting-a2a #10363

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 Part values 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

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.

Activity

  1. added
    python
    triage
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

pythontriage

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions