Skip to content

Answer A2A 1.0 JSON-RPC method names and enums; security schemes on the agent card - #66

Merged
echarles merged 1 commit into
mainfrom
feat/a2a-v1-jsonrpc
Oct 5, 2026
Merged

echarles merged 1 commit into
mainfrom
feat/a2a-v1-jsonrpc

Conversation

@echarles

@echarles echarles commented Oct 5, 2026

Copy link
Copy Markdown
Member

The agent card says protocolVersion: "1.0", but the server only answered the 0.3 method names (message/stream) and wrote enums in lower case (working, agent). A 1.0 client such as @a2a-js/sdk 1.x sends SendStreamingMessage and reads TASK_STATE_WORKING / ROLE_AGENT, so it could not talk to a fasta2a agent.

  • fasta2a.jsonrpc_v1: SendMessage, SendStreamingMessage, GetTask, CancelTask, SubscribeToTask, ListTasks are read as the methods they name, their enums (ROLE_*, TASK_STATE_*) read as this library's; tenant is dropped, returnImmediately dropped with acceptedOutputModes defaulted. The answer (JSON or SSE) is written with 1.0 enums. Requests with the existing names are answered exactly as before.
  • FastA2A(security_schemes=..., security_requirements=...): the card says how a caller authenticates (declared, not enforced: use middleware).
  • Tests: tests/test_jsonrpc_v1.py (6).

Locally on a fresh 3.12 env: ruff format/check clean, pyright 0 errors, pytest 43 passed.

Needed by agent-runtimes' team-of-applications example (a browser app on @a2a-js/sdk 1.3 calling an app served with fasta2a). Release as 2.1.0 after merge.

…ow a caller authenticates

The card says protocolVersion 1.0, but the server only knew the 0.3 method names (message/stream) and wrote enums in lower case (working, agent). A 1.0 client such as @a2a-js/sdk 1.x sends SendStreamingMessage and reads TASK_STATE_WORKING and ROLE_AGENT, so it could not talk to a fasta2a agent.

- fasta2a.jsonrpc_v1: SendMessage, SendStreamingMessage, GetTask, CancelTask, SubscribeToTask and ListTasks are read as the methods they name, with their enums (ROLE_*, TASK_STATE_*) read as this library's; tenant is dropped, and returnImmediately is dropped with acceptedOutputModes defaulted. The answer, JSON or event stream, is written with 1.0's enums. A request with the names this library always used is answered exactly as before.
- FastA2A(security_schemes=..., security_requirements=...): the card says how a caller authenticates. It is said, not enforced: a server checks it in its own middleware.
- tests/test_jsonrpc_v1.py.
Copilot AI balanced review requested due to automatic review settings October 5, 2026 07:47
@echarles
echarles merged commit a37517e into main Oct 5, 2026
8 checks passed
@echarles
echarles deleted the feat/a2a-v1-jsonrpc branch October 5, 2026 07:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Enum conversion can corrupt application payloads and leaves valid v1 task-status filters unnormalized.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds A2A 1.0 client compatibility to FastA2A while preserving legacy method handling.

Changes:

  • Translates v1 method names and enums for JSON and streaming responses.
  • Adds declarative authentication settings to the agent card; enforcement remains middleware-controlled.
  • Adds six tests covering compatibility and security declarations.
File Description
tests/​test_jsonrpc_v1.py Tests v1 translation, legacy behavior, and security declarations.
fasta2a/​jsonrpc_v1.py Implements request and response translation.
fasta2a/​applications.py Integrates translation and agent-card security settings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread fasta2a/jsonrpc_v1.py
Comment on lines +71 to +89
else:
out[key] = _enums_from_v1(item)
return out
if isinstance(value, list):
return [_enums_from_v1(item) for item in _array(value)]
return value


def to_v1(value: Any) -> Any:
"""A result of this server with its enums as A2A 1.0 writes them: `ROLE_*` and `TASK_STATE_*`."""
if isinstance(value, dict):
out: dict[str, Any] = {}
for key, item in _object(value).items():
if key == 'role' and isinstance(item, str):
out[key] = _ROLE_TO_V1.get(item, item)
elif key == 'state' and isinstance(item, str):
out[key] = _STATE_TO_V1.get(item, item)
else:
out[key] = to_v1(item)
Comment thread fasta2a/jsonrpc_v1.py
method = envelope.get('method')
if not isinstance(method, str) or method not in V1_METHODS:
return None
params = _object(_enums_from_v1(dict(_object(envelope.get('params') or {}))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants