# Instrument the agent with a single function call - this is the recommended approach
track_adk_agent_recursive(basic_agent, opik_tracer)
```

Each agent execution will now be automatically logged to the Opik platform with detailed trace information:

<Frame>
  <img src="https://files.buildwithfern.com/https://opik.docs.buildwithfern.com/docs/opik/2026-01-30T17:33:07.444Z/img/cookbook/google_adk_integration_basic_agent.png" />
</Frame>

This approach automatically handles:

* **All agent callbacks** (before/after agent, model, and tool executions)
* **Sub-agents** and nested agent hierarchies
* **Agent tools** that contain other agents
* **Complex workflows** with minimal code

## Example 2: Manual Callback Configuration (Alternative Approach)

For a fine-grained control over which callbacks to instrument, you can manually configure the [`OpikTracer`](https://www.comet.com/docs/opik/python-sdk-reference/integrations/adk/OpikTracer.html) callbacks. This approach gives you explicit control but requires more setup code:

```python