-
Notifications
You must be signed in to change notification settings - Fork 0
Add tracing library for ADK #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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
| ) | ||
|
|
||
| // Set span attributes | ||
| span.SetAttributes(attribute.String("agent.name", ctx.AgentName())) |
There was a problem hiding this comment.
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.*
There was a problem hiding this comment.
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()) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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.