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 appendstracea2a.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
Calltracea2a.InstrumentClient() after creating a client, and pass tracea2a.InstrumentServer() as an option to a2asrv.NewHandler().Go #skip-compile
What Braintrust traces
Braintrust captures:SendMessageandSendStreamingMessageclient calls astaskspans with span kindclient, nameda2a.SendMessageanda2a.SendStreamingMessageOnSendMessageandOnSendMessageStreamserver request handling astaskspans with span kindserver- Input: the
Messagefield ofMessageSendParams - 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
Taskshape) - Metadata: A2A method name, protocol (
a2a), and role (clientorserver) time_to_first_tokenin 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
GetTask, CancelTask), push notification methods, and agent card requests are not instrumented. Non-blocking SendMessage calls (where Config.Blocking is false) are also excluded.