Agent Development Kit

Agent Development Kit (ADK) is a flexible and modular framework for developing and deploying AI agents. ADK can be used with popular LLMs and open-source generative AI tools and is designed with a focus on tight integration with the Google ecosystem and Gemini models. ADK makes it easy to get started with simple agents powered by Gemini models and Google AI tools while providing the control and structure needed for more complex agent architectures and orchestration.

Opik integrates with ADK to log traces for all ADK agent execution.

Getting started

First, ensure you have both opik and google-adk installed:

$pip install opik google-adk

In addition, you can configure Opik using the opik configure command which will prompt you for the correct local server address or if you are using the Cloud platform your API key:

{pytest_codeblocks_skip=true}
$opik configure

Logging ADK agent executions

To log a ADK agent run, you can use the OpikTracer. This connector will log the agent run to the Opik platform:

1import datetime
2from zoneinfo import ZoneInfo
3
4from google.adk.agents import Agent
5from opik.integrations.adk import OpikTracer
6
7
8def get_weather(city: str) -> dict:
9 if city.lower() == "new york":
10 return {
11 "status": "success",
12 "report": (
13 "The weather in New York is sunny with a temperature of 25 degrees"
14 " Celsius (41 degrees Fahrenheit)."
15 ),
16 }
17 else:
18 return {
19 "status": "error",
20 "error_message": f"Weather information for '{city}' is not available.",
21 }
22
23
24def get_current_time(city: str) -> dict:
25 if city.lower() == "new york":
26 tz_identifier = "America/New_York"
27 else:
28 return {
29 "status": "error",
30 "error_message": (f"Sorry, I don't have timezone information for {city}."),
31 }
32
33 tz = ZoneInfo(tz_identifier)
34 now = datetime.datetime.now(tz)
35 report = f'The current time in {city} is {now.strftime("%Y-%m-%d %H:%M:%S %Z%z")}'
36 return {"status": "success", "report": report}
37
38
39opik_tracer = OpikTracer()
40
41root_agent = Agent(
42 name="weather_time_agent",
43 model="gemini-2.0-flash-exp",
44 description=("Agent to answer questions about the time and weather in a city."),
45 instruction=("I can answer your questions about the time and weather in a city."),
46 tools=[get_weather, get_current_time],
47 before_agent_callback=opik_tracer.before_agent_callback,
48 after_agent_callback=opik_tracer.after_agent_callback,
49 before_model_callback=opik_tracer.before_model_callback,
50 after_model_callback=opik_tracer.after_model_callback,
51 before_tool_callback=opik_tracer.before_tool_callback,
52 after_tool_callback=opik_tracer.after_tool_callback,
53)

Each agent execution will now be logged to the Opik platform: