[Feat]: validate_input_modes: match media ranges such as image/* declared in the agent card
I maintainer di solito rispondono entro 2 giorni
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Is your feature request related to a problem? Please describe.
With validate_input_modes=True, a card that declares a media range such as image/* rejects every concrete image type, because validate_input_modes compares type/subtype literally. The question was left open in #1425 ("a card that declares image/* still only matches that literal string ... Would you rather have them handled here?"); this issue is a place to settle it.
It matters across SDKs: Microsoft Agent Framework (agent-framework-hosting-a2a) documents wildcard modes such as image/* for the cards it builds and accepts image/png against them in its own conversion, and it returns a native a2a.types.AgentCard meant to be served with this SDK's request handlers. The same card then rejects the same message here:
import asyncio
from a2a.types import AgentInterface, Message as A2AMessage, Part, Role
from a2a.utils.input_mode_validator import validate_input_modes
from agent_framework import Agent
from agent_framework_hosting_a2a import AgentA2AAdapter
agent = Agent(client=None, name="vision", description="Describes images")
adapter = AgentA2AAdapter(
agent,
version="1.0.0",
supported_interfaces=[AgentInterface(url="http://localhost/a2a", protocol_binding="JSONRPC")],
default_input_modes=["text/plain", "image/*"],
)
card = asyncio.run(adapter.get_card())
msg = A2AMessage(message_id="m1", role=Role.ROLE_USER, parts=[Part(raw=b"\x89PNG", media_type="image/png")])
adapter.a2a_to_run(msg) # accepted by Agent Framework
validate_input_modes(msg, card) # rejected by a2a-sdk
card default_input_modes: ['text/plain', 'image/*']
Agent Framework conversion: accepted
a2a-sdk validate_input_modes: REJECTED: ContentTypeNotSupportedError Media type image/png is not supported. Supported input modes: image/*, text/plain
The same result on this repo's main (09c9347) with a plain AgentCard(name="v", default_input_modes=["text/plain", "image/*"]): image/png and video/mp4 are rejected, text/plain is accepted.
Describe the solution you'd like
Treat a declared mode of the form type/* as a media range (the RFC 9110 section 12.5.1 meaning): it matches any part whose essence has that type. */* matches everything. Matching keeps the current rules from #1425: case-insensitive, parameters ignored, and parts without media_type are not checked. Exact declarations behave as today, so text/html still fails against text/plain.
Concretely, in src/a2a/utils/input_mode_validator.py, a declared essence ending in /* would match by type prefix, with unit tests for image/* vs image/png, IMAGE/* vs image/png; q=1, image/* vs video/mp4 (rejected), and */*.
Describe alternatives you've considered
- Keep literal matching and document that cards must list concrete types. Cards built by other SDKs that already use ranges then have to be rewritten before validation can be turned on.
- Expand ranges when building the card. That needs a closed list of subtypes, which a range exists to avoid.
Additional context
The specification defines input modes as media types and does not mention ranges, so this is a policy choice for the SDK, as noted in #1425. If maintainers prefer literal matching, a sentence in the validate_input_modes docstring saying ranges are not supported would also close this. I would be glad to send the PR for whichever direction you choose.
AI assistance: the analysis, the reproduction and this report were prepared with an AI coding assistant; I ran both reproductions and checked the output above.
- Lingua principale
- Python
- Stelle
- 2.2k
- Fork
- 540
- Merge medio
- 2g 9h
- PR unite (30g)
- 56
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di a2aproject/a2a-python
-
[Bug]: `A2A-Version` validation ignores minor versions and the query parameterForse già presa @rohityan l’ha presa 82 giorni fa. Apertacomponent: server status:awaiting response status:stale
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
a2aproject/a2a-python#1204 · 4 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: REST task/request id sanitizationForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertamaintainers-only
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
a2aproject/a2a-python#805 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: JSON-RPC client ignores the JSON-RPC error body when the HTTP status is not 2xxForse già presa @rohityan l’ha presa oggi. Aperta
a2aproject/a2a-python#1475 · 2 assegnatari ·
I maintainer di solito rispondono entro 2 giorni
-
Required extensions aren't enforced, so ExtensionSupportRequiredError is never raisedForse già presa @rohityan l’ha presa 2 giorni fa. Apertacomponent: server status:awaiting response
a2aproject/a2a-python#1467 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
-
[Bug]: ListTasks prints unset fields on every task (history: [] with historyLength=0, empty mediaType/filename on parts)Forse già presa @rohityan l’ha presa 3 giorni fa. Aperta
a2aproject/a2a-python#1461 · 1 assegnatario ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di a2aproject/a2a-python
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Install the skills as a Claude Code pluginForse già presa @ruban-24 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 6 giorni
-
Make the usage of time-zone aware UTC timestamps the norm across the pynxtools NOMAD ecosystemAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
FAIRmat-NFDI/pynxtools#874 ·
-
Eval: PublicationApertadata
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100