Support Google agents ADK tracing
Description
Do you support agents adk for tracing? If not, is it possible to add support?
Yes: https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents
Do you think this needs to be more discoverable in the docs somehow?
Yes: https://logfire.pydantic.dev/docs/integrations/llms/openai/#openai-agents
Do you think this needs to be more discoverable in the docs somehow?
Sorry I mean the Google agents ADK
Ah, sorry, didn't even notice it said ADK instead of SDK
The ADK comes with built in OpenTelemetry tracing. Therefore all you need is to call logfire.configure(). Here's some sample code to demo it working:
import asyncio
from google.adk import Agent, Runner
from google.adk.sessions import InMemorySessionService
from google.genai import types
import logfire
logfire.configure()
# 1. ‘say_hello’ tool
def say_hello():
return {'greeting': 'Hello 👋'}
agent = Agent(
name='hello_agent',
model='gemini-2.0-flash',
instruction='Always greet using the say_hello tool.',
tools=[say_hello],
)
# 2. session service + runner
session_service = InMemorySessionService()
APP_NAME = 'hello_app'
USER_ID = 'demo-user'
SESSION_ID = 'demo-session' # any string; UUIDs work too
# create the session once
async def main():
await session_service.create_session(app_name=APP_NAME, user_id=USER_ID, session_id=SESSION_ID)
runner = Runner(agent=agent, app_name=APP_NAME, session_service=session_service)
# 3. single‑turn run
user_msg = types.Content(role='user', parts=[types.Part(text='hi')])
async for event in runner.run_async(user_id=USER_ID, session_id=SESSION_ID, new_message=user_msg):
if event.is_final_response():
print(event.content.parts[0].text)
if __name__ == '__main__':
asyncio.run(main())
But I see that the attributes are not quite in the format needed to be displayed nicely in our UI. We can fix that.
Awesome thanks!