Working with Agents
Enable end-to-end tracing for AI agent frameworks with LangDB’s one-line init() integration.
LangDB integrates seamlessly with a variety of agent libraries to provide out-of-the-box tracing, observability, and cost insights. By simply initializing the LangDB client adapter for your agent framework, LangDB monkey‑patches the underlying client to inject tracing hooks—no further code changes required.
Prerequisites
LangDB Core installed:
pip install pylangdb
Optional feature flags (for framework-specific tracing):
pip install pylangdb[<library_feature>] # e.g. pylangdb[adk], pylangdb[openai_agents]
Environment Variables set:
export LANGDB_API_KEY="xxxxx" export LANGDB_PROJECT_ID="xxxxx"
Quick Start
Import and initialize once, before creating or running any agents:
from langdb.<library> import init
# Monkey‑patch the client for tracing
init()
# ...then your existing agent setup...
Monkey‑patching note: The
init()
call wraps key client methods at runtime to capture telemetry. Ensure it runs as early as possible.
GitHub Repo: https://github.com/langdb/pylangdb
Example: Google ADK
pip install pylangdb[adk]
from pylangdb.adk import init
init()
from google.adk.agents import Agent
# (rest of your Google ADK agent code)
This is an example of complete end-to-end trace using Google ADK and LangDB.

LangDB’s ADK adapter captures request/response metadata, token usage, and latenc metrics automatically. During initialization it discovers and wraps all agents and sub‑agents in subfolders, linking their sessions for full end‑to‑end tracing across your workflow.
Supported Frameworks
Last updated
Was this helpful?