Skip to content

feat: add traceai-a2a - Agent-to-Agent Protocol instrumentation#153

Open
VaishnavGunjari wants to merge 1 commit intofuture-agi:mainfrom
VaishnavGunjari:feature/traceai-a2a-instrumentation
Open

feat: add traceai-a2a - Agent-to-Agent Protocol instrumentation#153
VaishnavGunjari wants to merge 1 commit intofuture-agi:mainfrom
VaishnavGunjari:feature/traceai-a2a-instrumentation

Conversation

@VaishnavGunjari
Copy link
Copy Markdown

@VaishnavGunjari VaishnavGunjari commented Apr 8, 2026

Adds a new Python instrumentation package for Google's A2A Protocol, enabling distributed tracing across multi-agent boundaries.

What this does:

-Propagates W3C TraceContext headers across agent boundaries, stitching multi-agent calls into a single trace
-A2AInstrumentor wraps send_task() and send_task_streaming() with zero config
-A2ATracingMiddleware extracts inbound trace context (FastAPI/Starlette compatible)
-11 new span attributes under gen_ai.a2a.* namespace
-Includes a full multi-agent demo and 16 unit tests

Checklist

  • Code compiles correctly.
  • Created/updated tests.
  • Linting and formatting applied.
  • Documentation updated.

Adds a new Python instrumentation package for Google's A2A Protocol,
enabling distributed tracing across multi-agent boundaries.

Key capabilities:
- W3C TraceContext (traceparent/tracestate) propagation via A2AClient
  outbound HTTP headers, stitching multi-agent traces into one
- A2AInstrumentor: zero-config instrumentation following BaseInstrumentor
  pattern, wrapping send_task() and send_task_streaming() with wrapt
- A2ATracingMiddleware: ASGI middleware for inbound context extraction
  on the receiving agent side (Starlette/FastAPI compatible)
- 11 new SpanAttributes in gen_ai.a2a.* namespace
  (task ID/state, agent URL, AgentCard name/version, message role,
   artifact type, streaming flag, push notification URL, propagated trace ID)
- 2 new FiSpanKindValues: A2A_CLIENT and A2A_SERVER
- 3 new EvalName values: a2a_task_completion, a2a_response_alignment,
  a2a_safety_pass_through
- Full attribute extractor for Task, Message, AgentCard, and streaming
  artifact events (handles both SDK objects and raw dicts)
- Complete multi-agent demo with mock agents (no real SDK required)
- 16 unit tests: span creation, attribute recording, W3C propagation
  (the key end-to-end test), ASGI middleware, instrumentor lifecycle,
  error handling, and semantic convention completeness

Files:
  python/fi_instrumentation/fi_types.py            (modified)
  python/frameworks/a2a/pyproject.toml             (new)
  python/frameworks/a2a/CHANGELOG.md               (new)
  python/frameworks/a2a/README.md                  (new)
  python/frameworks/a2a/traceai_a2a/__init__.py    (new)
  python/frameworks/a2a/traceai_a2a/_a2a_client.py (new)
  python/frameworks/a2a/traceai_a2a/_a2a_server.py (new)
  python/frameworks/a2a/traceai_a2a/_attributes.py  (new)
  python/frameworks/a2a/traceai_a2a/_semantic_conventions.py (new)
  python/frameworks/a2a/traceai_a2a/version.py     (new)
  python/frameworks/a2a/traceai_a2a/py.typed       (new)
  python/frameworks/a2a/examples/multi_agent_demo.py (new)
  python/tests/test_framework_a2a.py               (new)
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.

1 participant