# braintrust-adk
SDK for integrating [Braintrust](https://braintrust.dev) with [Google ADK (Agent Development Kit)](https://github.com/google/adk-python). This package provides automatic tracing and logging of ADK agent executions to Braintrust.
## Installation
```bash
pip install braintrust-adk
```
## Requirements
- Python >= 3.9
- Google ADK >= 1.9.0
- Braintrust Dataplane >= 1.1.19 (applicable only for hybrid deployment customers)
- Braintrust (with Otel support) >= 0.2.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
```python
from google.adk.agents import LlmAgent
from braintrust_adk import setup_braintrust
# Initialize Braintrust tracing
setup_braintrust(
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)
```
### Environment Variables
You can configure the integration using environment variables:
```bash
# Required for Braintrust tracing
export BRAINTRUST_API_KEY="your-api-key"
# Optional: specify project name or ID
export BRAINTRUST_PARENT="project_name:my-project"
# or
export BRAINTRUST_PARENT="project_id:your-project-id"
# Optional: enable debug logging
export OTEL_DEBUG="true"
```
### Advanced Configuration
#### Using Project ID
If you know your Braintrust project ID, you can use it directly:
```python
setup_braintrust(
api_key="your-api-key",
project_id="your-project-id" # Use project ID instead of name
)
```
#### Custom Tools with Tracing
The integration automatically traces all tool calls made by your agents:
```python
def get_weather(city: str) -> dict:
"""Get weather for a city."""
# Your implementation here
return {"status": "success", "temperature": 72, "city": city}
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?"
)
```
## 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:
1. Navigate to your project in [Braintrust](https://braintrust.dev)
2. Click on "Logs" to see all agent executions
3. 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:
```bash
# Clone the repository
git clone https://github.com/braintrustdata/sdk.git
cd sdk/integrations/adk-py
# Install in development mode
pip install -e ".[dev]"
# Run examples
cd examples
make dev
```
## Related Resources
- [Braintrust Documentation](https://www.braintrust.dev/docs)
- [Google ADK Documentation](https://github.com/google/genai-agent-dev-kit)
Raw data
{
"_id": null,
"home_page": null,
"name": "braintrust-adk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "braintrust, google-adk, adk, agents, ai, llm, tracing",
"author": null,
"author_email": "Braintrust <info@braintrust.dev>",
"download_url": "https://files.pythonhosted.org/packages/c9/77/67b5bb8ee00ccf732ff853719f95aeeef1003d09f49bf50d9c8d344e4bdb/braintrust_adk-0.1.0.tar.gz",
"platform": null,
"description": "# braintrust-adk\n\nSDK for integrating [Braintrust](https://braintrust.dev) with [Google ADK (Agent Development Kit)](https://github.com/google/adk-python). This package provides automatic tracing and logging of ADK agent executions to Braintrust.\n\n## Installation\n\n```bash\npip install braintrust-adk\n```\n\n## Requirements\n\n- Python >= 3.9\n- Google ADK >= 1.9.0\n- Braintrust Dataplane >= 1.1.19 (applicable only for hybrid deployment customers)\n- Braintrust (with Otel support) >= 0.2.1\n\n## Quick Start\n\nThe `braintrust-adk` integration automatically traces your ADK agents' execution, including:\n\n- Agent invocations and responses\n- Tool calls and their results\n- Parallel execution flows\n- Multi-step agent reasoning\n\n### Basic Usage\n\n```python\nfrom google.adk.agents import LlmAgent\nfrom braintrust_adk import setup_braintrust\n\n# Initialize Braintrust tracing\nsetup_braintrust(\n api_key=\"your-api-key\", # Or set BRAINTRUST_API_KEY env var\n project_name=\"my-adk-project\" # Optional: defaults to \"default-google-adk-py\"\n)\n\n# Create your ADK agent as normal\nagent = LlmAgent(\n tools=[get_weather, get_current_time],\n model=\"gemini-2.0-flash-exp\",\n system_instruction=\"You are a helpful assistant that can check weather and time.\"\n)\n\n# Use the agent - all interactions are automatically traced to Braintrust\nresponse = agent.send_message(\"What's the weather like in New York?\")\nprint(response.text)\n```\n\n### Environment Variables\n\nYou can configure the integration using environment variables:\n\n```bash\n# Required for Braintrust tracing\nexport BRAINTRUST_API_KEY=\"your-api-key\"\n\n# Optional: specify project name or ID\nexport BRAINTRUST_PARENT=\"project_name:my-project\"\n# or\nexport BRAINTRUST_PARENT=\"project_id:your-project-id\"\n\n# Optional: enable debug logging\nexport OTEL_DEBUG=\"true\"\n```\n\n### Advanced Configuration\n\n#### Using Project ID\n\nIf you know your Braintrust project ID, you can use it directly:\n\n```python\nsetup_braintrust(\n api_key=\"your-api-key\",\n project_id=\"your-project-id\" # Use project ID instead of name\n)\n```\n\n#### Custom Tools with Tracing\n\nThe integration automatically traces all tool calls made by your agents:\n\n```python\ndef get_weather(city: str) -> dict:\n \"\"\"Get weather for a city.\"\"\"\n # Your implementation here\n return {\"status\": \"success\", \"temperature\": 72, \"city\": city}\n\ndef search_flights(origin: str, destination: str, date: str) -> dict:\n \"\"\"Search for flights.\"\"\"\n # Your implementation here\n return {\"flights\": [...]}\n\n# Create agent with multiple tools\nagent = LlmAgent(\n tools=[get_weather, search_flights],\n model=\"gemini-2.0-flash-exp\",\n system_instruction=\"You are a travel assistant.\"\n)\n\n# All tool calls are automatically traced\nresponse = agent.send_message(\n \"I need to fly from NYC to LA tomorrow. What's the weather like in LA?\"\n)\n```\n\n## Examples\n\nThe `examples/` directory contains complete working examples:\n\n## Viewing Traces in Braintrust\n\nOnce you've set up the integration, you can view your traces in the Braintrust dashboard:\n\n1. Navigate to your project in [Braintrust](https://braintrust.dev)\n2. Click on \"Logs\" to see all agent executions\n3. Click on any log entry to see the full trace including:\n - Agent reasoning steps\n - Tool calls and responses\n - Token usage and latency metrics\n - Any errors or warnings\n\n## Development\n\nTo contribute to this integration:\n\n```bash\n# Clone the repository\ngit clone https://github.com/braintrustdata/sdk.git\ncd sdk/integrations/adk-py\n\n# Install in development mode\npip install -e \".[dev]\"\n\n# Run examples\ncd examples\nmake dev\n```\n\n## Related Resources\n\n- [Braintrust Documentation](https://www.braintrust.dev/docs)\n- [Google ADK Documentation](https://github.com/google/genai-agent-dev-kit)\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Braintrust Google ADK integration",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://www.braintrust.dev",
"Repository": "https://github.com/braintrustdata/braintrust-sdk"
},
"split_keywords": [
"braintrust",
" google-adk",
" adk",
" agents",
" ai",
" llm",
" tracing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a7d642d160ab8f01c1bb5d4b42cd9a3fa45c63e2bf0a11be9dc8f1bdaede7f45",
"md5": "23f18139b16f7ed8349db1e311bfe368",
"sha256": "2790ced5fb53686f62474d88a9202d7b9aefdbfe8066350a59d46aad79baf781"
},
"downloads": -1,
"filename": "braintrust_adk-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "23f18139b16f7ed8349db1e311bfe368",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 3513,
"upload_time": "2025-08-12T01:12:39",
"upload_time_iso_8601": "2025-08-12T01:12:39.112082Z",
"url": "https://files.pythonhosted.org/packages/a7/d6/42d160ab8f01c1bb5d4b42cd9a3fa45c63e2bf0a11be9dc8f1bdaede7f45/braintrust_adk-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "c97767b5bb8ee00ccf732ff853719f95aeeef1003d09f49bf50d9c8d344e4bdb",
"md5": "d8a6b97c8f6e75cbec6fc3143fdaf62d",
"sha256": "32436b6ee8715257efbbe0e9c3b71f4b8223e912a44178854ce9b176ed38e5f5"
},
"downloads": -1,
"filename": "braintrust_adk-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d8a6b97c8f6e75cbec6fc3143fdaf62d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3608,
"upload_time": "2025-08-12T01:12:40",
"upload_time_iso_8601": "2025-08-12T01:12:40.506448Z",
"url": "https://files.pythonhosted.org/packages/c9/77/67b5bb8ee00ccf732ff853719f95aeeef1003d09f49bf50d9c8d344e4bdb/braintrust_adk-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-12 01:12:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "braintrustdata",
"github_project": "braintrust-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "braintrust-adk"
}