This project has been archived by its maintainers, and is no longer receiving any updates.
braintrust-adk (DEPRECATED)
SDK for integrating Braintrust with Google ADK (Agent Development Kit). This package provides automatic tracing and logging of ADK agent executions to Braintrust.
This package is deprecated. The Google ADK integration is now included in the main
braintrustpackage.
Migration
- Remove
braintrust-adkfrom your dependencies - Install or upgrade
braintrust:pip install --upgrade braintrust
- Update your imports:
# Before from braintrust_adk import setup_adk # After (option 1: auto-instrument adk library) import braintrust braintrust.auto_instrument() # After (option 2: explicit) from braintrust.wrappers.adk import setup_adk setup_adk()
The API is identical - no code changes needed beyond the import path.
Installation
pip install braintrust-adk
Requirements
- Python >= 3.9
- Google ADK >= 1.14.1
Quick Start
The braintrust-adk integration automatically traces your ADK agents' execution, including:
- Agent invocations and responses
- Tool calls and their results
- Parallel execution flows
- Multi-step agent reasoning
Basic Usage
from google.adk.agents import LlmAgent
from braintrust_adk import setup_adk
# Initialize Braintrust tracing
setup_adk(
api_key="your-api-key", # Or set BRAINTRUST_API_KEY env var
project_name="my-adk-project" # Optional: defaults to "default-google-adk-py"
)
# Create your ADK agent as normal
agent = LlmAgent(
tools=[get_weather, get_current_time],
model="gemini-2.0-flash-exp",
system_instruction="You are a helpful assistant that can check weather and time."
)
# Use the agent - all interactions are automatically traced to Braintrust
response = agent.send_message("What's the weather like in New York?")
print(response.text)
Advanced Configuration
Using Project ID
If you know your Braintrust project ID, you can use it directly:
setup_adk(
api_key="your-api-key",
project_id="your-project-id" # Use project ID instead of name
)
Custom Tools with Tracing
Other braintrust functions like traced work seamlessly with this integration.
from braintrust import traced
@traced
def get_weather(city: str) -> dict:
"""Get weather for a city."""
# Your implementation here
return {"status": "success", "temperature": 72, "city": city}
@traced
def search_flights(origin: str, destination: str, date: str) -> dict:
"""Search for flights."""
# Your implementation here
return {"flights": [...]}
# Create agent with multiple tools
agent = LlmAgent(
tools=[get_weather, search_flights],
model="gemini-2.0-flash-exp",
system_instruction="You are a travel assistant."
)
# All tool calls are automatically traced
response = agent.send_message(
"I need to fly from NYC to LA tomorrow. What's the weather like in LA?"
)
Manual Patching
The setup_adk will automatically patch Google ADK Runner, Agent, and Flow classes to automatically trace all agent interactions. If you prefer to manually patch classes, you can use the wrap_agent, wrap_runner, and wrap_flow functions. Take a look at the manual example.
Note that, as of writing, adk web does not support custom Runners and you will need to use setup_adk if you would like LLM traces.
Examples
The examples/ directory contains complete working examples:
Viewing Traces in Braintrust
Once you've set up the integration, you can view your traces in the Braintrust dashboard:
- Navigate to your project in Braintrust
- Click on "Logs" to see all agent executions
- Click on any log entry to see the full trace including:
- Agent reasoning steps
- Tool calls and responses
- Token usage and latency metrics
- Any errors or warnings
Development
To contribute to this integration:
# Clone the repository
git clone https://github.com/braintrustdata/braintrust-sdk-python.git
cd sdk/integrations/adk-py
uv sync
# Run examples
cd examples
# simple programmatic agent call
uv run manual.py
# or use the adk web UI
uv run adk web --port 8888
Related Resources
Metadata
Release files for braintrust-adk 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| braintrust_adk-0.4.0.tar.gz | 4.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| braintrust_adk-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.0 kB
Release files / braintrust_adk-0.4.0.tar.gz
| Download URL | braintrust_adk-0.4.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c042139cfbd9546e739175a8cceb0b93e2f992e976b92de74298608991d769b
|
|
BLAKE2b-256 checksum How to use checksums |
fe5b65282cc58bebe2e635826c72d5be0585303d82fd601796230b978d08d42d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / braintrust_adk-0.4.0-py3-none-any.whl
| Download URL | braintrust_adk-0.4.0-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8228b8f05d0c2485c1731fb805068f218e189b0953cac2640b282500f21b3d50
|
|
BLAKE2b-256 checksum How to use checksums |
5c54412ad8fac4d47fb93ff01196288cf5d81794f88facab51762a050f7dd81a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|