BotGauge Python SDK
Trace AI agents in production, safely and privately, without slowing your application down.
Built on OpenTelemetry.
BotGauge records what your agents do: every turn of a conversation, the agents involved, their LLM calls with model and token counts, and their tool calls. You see it in the BotGauge console as sessions you can search and inspect.
- Two ways in. Add three lines to your code, or trace an existing app without changing it:
botgauge instrument python app.py. - Private by default. Detected PII and credentials (emails, card numbers, API keys, passwords) are masked before anything leaves your process. Images, audio and embeddings stay out unless you ask for them.
- Never in your way. Export runs on a background thread with bounded queues and timeouts. A slow or unreachable endpoint never blocks or crashes your app.
- Standard OpenTelemetry. It works alongside your existing OpenTelemetry setup and carries W3C trace context across services.
Install
pip install botgauge # the tracing SDK (Python library) and the `botgauge` command
botgauge setup --install # adds tracing for the frameworks your app uses
What pip install botgauge gives you: the tracing SDK (from botgauge import tracing) and the
botgauge command. On its own it records the turns, agents and spans your code creates. It does not
install tracing for every framework BotGauge supports; you add only what your app uses:
botgauge setup --installfinds the frameworks installed in your environment (without importing them) and installs the matching BotGauge extra for each, such asbotgauge[langchain], at your installed BotGauge version.botgauge setup --detectlists them without installing anything.- Or name the extra yourself, for example in
requirements.txt:botgauge[langchain]. The extras are listed under Frameworks.
An extra adds the instrumentation that records your framework's LLM calls (model, prompts, token counts) and tool calls.
No botgauge command installs anything except setup --install: botgauge instrument uses what is
installed and, when your app imports a framework without its tracing, logs which extra to add.
Get an API key
Sign in at cloud.botgauge.com and create an API key. It starts with
bg_. Then make it available to your app:
export BOTGAUGE_API_KEY="bg_..."
Quickstart
Zero-code: trace an existing app as it is. botgauge instrument turns on the tracing your
extras installed.
botgauge instrument python app.py
In code: start tracing, attach your framework's instrumentor, and wrap each turn of a conversation.
from botgauge import tracing
from openinference.instrumentation.langchain import LangChainInstrumentor
provider = tracing.init() # reads BOTGAUGE_API_KEY
LangChainInstrumentor().instrument(tracer_provider=provider)
with tracing.turn(session_id="ses_123"), tracing.agent("support-agent"):
... # your agent's LLM and tool calls
tracing.shutdown() # flushes on exit
botgauge doctor checks your setup: installed instrumentation, trace propagation and configuration.
Frameworks
| Framework | Extra | Instrumentor, in code |
|---|---|---|
| LangChain, LangGraph | botgauge[langchain], botgauge[langgraph] |
LangChainInstrumentor |
| OpenAI SDK | botgauge[openai] |
OpenAIInstrumentor |
| Anthropic SDK | botgauge[anthropic] |
AnthropicInstrumentor |
| LlamaIndex | botgauge[llamaindex] |
LlamaIndexInstrumentor |
| CrewAI | botgauge[crewai] |
CrewAIInstrumentor and OpenAIInstrumentor |
| OpenAI Agents | botgauge[openai-agents] |
OpenAIAgentsInstrumentor |
| Google ADK | botgauge[google-adk] |
GoogleADKInstrumentor |
| AutoGen AgentChat | botgauge[autogen-agentchat] |
AutogenAgentChatInstrumentor |
| PydanticAI | botgauge[pydantic-ai] |
See below |
| MCP | botgauge[mcp] |
MCPInstrumentor |
| HTTP and gRPC trace context across services | botgauge[distributed] |
Zero-code only |
In code, import the instrumentor from openinference.instrumentation.<framework> (for example
from openinference.instrumentation.openai import OpenAIInstrumentor) and call
.instrument(tracer_provider=provider) on it after provider = tracing.init(), as in the
quickstart. PydanticAI instruments itself instead:
from botgauge import tracing
from openinference.instrumentation.pydantic_ai import OpenInferenceSpanProcessor
from pydantic_ai import Agent
from pydantic_ai.models.instrumented import InstrumentationSettings
provider = tracing.init()
# version=5 for PydanticAI 2; use version=3 on PydanticAI 1.x
Agent.instrument_all(InstrumentationSettings(tracer_provider=provider, version=5))
provider.add_span_processor(OpenInferenceSpanProcessor())
Zero-code needs none of this: botgauge instrument does it for every installed extra.
BotGauge verifies exact framework and instrumentor versions in CI. Other versions are traced too, and startup says when a version isn't one BotGauge has verified, and why.
Already instrumented, or a framework not listed?
- You already have the instrumentor installed:
pip install botgaugeis enough.botgauge instrumentfinds installed instrumentors whichever way they were installed, and traces a version BotGauge hasn't verified too, saying so at startup. If your app already calls.instrument()itself, BotGauge leaves it alone instead of instrumenting twice; setBOTGAUGE_PRODUCER_OWNER=<framework>=customerto make that explicit. - You already use OpenTelemetry:
tracing.init()attaches to your existing tracer provider instead of replacing it, so spans from your instrumentation are exported to BotGauge too, with the same privacy masking. - Your framework is not in the table: zero-code doesn't trace it, but in code you can. Install
its OpenInference instrumentor, or any instrumentor that
follows the OpenTelemetry GenAI conventions, and call
.instrument(tracer_provider=provider)afterprovider = tracing.init(). BotGauge exports those LLM and tool spans with the same privacy masking; they just aren't versions BotGauge has verified. - Your framework calls the OpenAI or Anthropic SDK underneath:
botgauge[openai]orbotgauge[anthropic]traces those LLM calls, zero-code included, without the framework's own steps. - Anything else you can trace yourself with
tracing.turn(),tracing.agent()andtracing.get_tracer().
Privacy controls
| Setting | Default | Options |
|---|---|---|
BOTGAUGE_CAPTURE / capture= |
text: prompts, responses and tool data, without media |
metadata (model, tokens, timing only), text, full (adds images, audio and embeddings) |
BOTGAUGE_REDACTED / redacted= |
true: detected PII and credentials are masked |
false exports original content without masking, in every capture mode: it overrides the capture setting |
OTEL_SDK_DISABLED=true turns tracing off without code changes.
Packages
| Package | What it is |
|---|---|
botgauge |
This meta-package. It installs the two below; its extras add framework instrumentation |
botgauge-tracing |
The tracing SDK, imported as from botgauge import tracing. Its page has the full guide and every setting |
botgauge-cli |
The botgauge command (alias botg): instrument, doctor, probe, setup, help, version |
All three release together with the same version. Python 3.10 or later.
Links
- Website: botgauge.com
- Console and API keys: cloud.botgauge.com
- Support: support@botgauge.com
License
Functional Source License, Version 1.1, ALv2 Future License (FSL-1.1-ALv2). You may use, modify and
redistribute the software for any purpose other than a competing commercial product or service. Each
release becomes available under the Apache License 2.0 two years after it is published.
Metadata
Release files for botgauge 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| botgauge-0.1.1.tar.gz | 8.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| botgauge-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / botgauge-0.1.1.tar.gz
| Download URL | botgauge-0.1.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1690e123ef065f351c13f504da7274f318fe26ac156833c8998a77b86b139632
|
|
BLAKE2b-256 checksum How to use checksums |
601593c78402a3d8e50cca3cdf97799c678911dd5ac7b1f240731e6dfebe15eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / botgauge-0.1.1-py3-none-any.whl
| Download URL | botgauge-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf19d9dcdbd1e92a72936adf0989946991dd8e7fd46544348c7e5a7a07f70920
|
|
BLAKE2b-256 checksum How to use checksums |
c8da43a7e9ad5dcee327a569cd781ab950fdeb4f5fd43b1974915f7439957766
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for botgauge 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for botgauge-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.