Skip to content

Conversation

@aswink
Copy link

@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
)

// Set span attributes
span.SetAttributes(attribute.String("agent.name", ctx.AgentName()))
Copy link
Contributor

Choose a reason for hiding this comment

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

i think the metadata should be prefixed by adk.*

Copy link
Author

Choose a reason for hiding this comment

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

Will update, I assume that I should leave the standard attributes in the model/tool calls the same, like "tool.description" or "gen_ai.prompt_tokens"? Or should I change those too?

}

// Delete all spans from this session
c.deleteAllSessionSpans(ctx.SessionID())
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any risk of stomping parallel sub agents or anything like that?

Copy link
Author

Choose a reason for hiding this comment

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

good question, let me read up a bit and also try out parallel agents to confirm

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.

3 participants