Skip to main content
The A2A (Agent2Agent) protocol is an open standard for agent-to-agent communication. Braintrust traces A2A client calls and server request handling, capturing inputs, outputs, and timing across distributed agent interactions.

Setup

Install the Braintrust Go SDK alongside the A2A Go SDK, then configure your API key.
1

Install packages

2

Set environment variables

.env

Auto-instrumentation

To trace A2A calls without modifying your application code, build your app with Orchestrion. Orchestrion appends tracea2a.NewClientInterceptor() to a2aclient.NewFromCard(), a2aclient.NewFromEndpoints(), and a2aclient.NewFactory() calls, and appends tracea2a.InstrumentServer() to a2asrv.NewHandler() calls at compile time.
1

Install Orchestrion

2

Create orchestrion.tool.go in your project root

orchestrion.tool.go
3

Initialize Braintrust and use the A2A SDK as normal

Go #skip-compile
4

Build and run with Orchestrion

Manual instrumentation

Call tracea2a.InstrumentClient() after creating a client, and pass tracea2a.InstrumentServer() as an option to a2asrv.NewHandler().
Go #skip-compile

What Braintrust traces

Braintrust captures:
  • SendMessage and SendStreamingMessage client calls as task spans with span kind client, named a2a.SendMessage and a2a.SendStreamingMessage
  • OnSendMessage and OnSendMessageStream server request handling as task spans with span kind server
  • Input: the Message field of MessageSendParams
  • Output: the response message for non-streaming calls, and for streaming calls the accumulated content across all events (artifact parts and final status merged into the Task shape)
  • Metadata: A2A method name, protocol (a2a), and role (client or server)
  • time_to_first_token in span metrics, measured when the first content-bearing event arrives
  • Error status and exception event when a call fails
  • W3C TraceContext propagation across the A2A client-server boundary, so client and server spans share the same trace
Detached task lifecycle methods (GetTask, CancelTask), push notification methods, and agent card requests are not instrumented. Non-blocking SendMessage calls (where Config.Blocking is false) are also excluded.

Resources