Skip to content

Add tracing library for ADK#37

Merged
aswink merged 12 commits intomainfrom
aswin/adk-tracing
Feb 9, 2026
Merged

Add tracing library for ADK#37
aswink merged 12 commits intomainfrom
aswin/adk-tracing

Conversation

@aswink
Copy link
Copy Markdown
Contributor

@aswink aswink commented Feb 2, 2026

Add a library to help trace Google's Agent Development Kit. The built in tracing is not consistent, google/adk-go#479, so implement our own tracing and also skip exporting the built in traces to Braintrust. Since ADK already has callbacks at every stage, it should be easy to add tracing, we just have to do some manual bookkeeping in order to set the parent and child relationships correctly because ADK is not doing that natively by passing around contexts in that way.

Also added an example script based on the adk library's examples, though I modified it a bit because the base example never exits cleanly, which breaks some tracing. The new version uses ctrl+c to cleanly exit.

Add a library to help trace Google's Agent Development Kit. The built in
tracing is not consistent, google/adk-go#479, so
implement our own tracing and also skip exporting the built in traces to
Braintrust. Since ADK already has callbacks at every stage, it should be easy
to add tracing, we just have to do some manual bookkeeping in order to set the
parent and child relationships correctly because ADK is not doing that natively
by passing around contexts in that way.

Also added an example script based on the adk library's examples, though I
modified it a bit because the base example never exits cleanly, which breaks
some tracing. The new version uses ctrl+c to cleanly exit.

Add traceadk

Drop native ADK spans

Fix agent/model tracing
@aswink aswink marked this pull request as draft February 2, 2026 19:19
Comment thread trace/contrib/adk/traceadk.go
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
@aswink aswink marked this pull request as ready for review February 4, 2026 21:13
@aswink aswink marked this pull request as draft February 4, 2026 21:23
Let the server handle this format instead. Do remove empty values, though,
rather than unnecessarily storing them.
Copy link
Copy Markdown
Contributor

@clutchski Matt Perpick (clutchski) left a comment

Choose a reason for hiding this comment

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

Great stuff. We also need auto instrumentation!

Comment thread trace/contrib/adk/traceadk_test.go Outdated
Comment thread config/config.go Outdated
Comment thread config/config.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread examples/adk/parallel/main.go Outdated
Comment thread options.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go Outdated
Comment thread trace/contrib/adk/traceadk.go
Comment thread trace/contrib/adk/traceadk.go Outdated
* Remove binary file
* API changes
* Update traceadk_test.go to use real ADK library with VCR
* Add autoinstrumentation with orchestrion
@aswink aswink marked this pull request as ready for review February 5, 2026 19:52
This can double the size of the payload, which can be particularly bad for
tests like ones with images.
Comment thread config/config.go Outdated
Comment thread examples/adk/main.go Outdated
Comment thread examples/internal/adk-parallel/main.go
Comment thread go.mod
module github.com/braintrustdata/braintrust-sdk-go

go 1.24.0
go 1.24.4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

do we need this? maybe just curious. it's changing the minimum version required.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

discussed offline, but turns out adk-go's minimum support go version is 1.24.0, even for the very first release of adk-go

* Move parallel adk example into proper directory
* Rename DropAdkTraces to EnableBuiltinAdkTraces (and reverse the meaning)
* Simplify ADK examples
Comment thread examples/adk/main.go
Instruction: "You are a helpful assistant that helps users with various tasks. You can tell the current time in any timezone using the get_time tool.",
Tools: []tool.Tool{timeTool},
}
traceadk.AddLLMAgentCallbacks(&cfg)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

<3

Copy link
Copy Markdown
Contributor

@clutchski Matt Perpick (clutchski) left a comment

Choose a reason for hiding this comment

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

a few changes requested.

we need auto instrumentation before merging. i dont want to have to document exceptions ... "we have autoinstrumentation but not for go-adk".

it's very easy to do / test.

@aswink
Copy link
Copy Markdown
Contributor Author

aswink commented Feb 6, 2026

a few changes requested.

we need auto instrumentation before merging. i dont want to have to document exceptions ... "we have autoinstrumentation but not for go-adk".

it's very easy to do / test.

This change does have auto instrumentation, like https://github.com/braintrustdata/braintrust-sdk-go/pull/37/files#diff-81730da075f184826fbcd61855b55bab6ac24206836896709cfebcedc1f42442?

Example trace from running that: https://www.braintrust.dev/app/braintrustdata.com/p/go-sdk-examples/logs?r=da45b08774a5c8a05adb2da51f7e940e&s=2a74b6d947cec316 (my openai and anthropic keys may not be working if you see issues in those spans)

@aswink aswink merged commit c9dceb8 into main Feb 9, 2026
10 checks passed
@aswink aswink deleted the aswin/adk-tracing branch February 9, 2026 18:59
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