Skip to main content

Installation

pip install decimalai
Framework dependencies:
# OpenAI Agents SDK and LangChain / LangGraph need no extra — their deps are core
pip install decimalai

# LlamaIndex ships as an extra
pip install decimalai[llamaindex]

Quick Start

import decimalai

decimalai.init(api_key="dai_sk_...")

# That's it — all supported framework calls are now traced.
# For framework-specific auto-instrumentation, add a flag:
decimalai.init(api_key="dai_sk_...", openai_agents=True)

decimalai.init()

Initialize the SDK. Must be called once before any other method.
decimalai.init(
    api_key="dai_sk_...",
    project="my-project",
    langchain=True,
)
api_key
str
default:"DECIMAL_API_KEY env"
Your DecimalAI API key. Falls back to DECIMAL_API_KEY environment variable.
base_url
str
default:"https://api.decimal.ai"
Backend URL. Override for self-hosted deployments.
project
str
default:"None"
Optional project grouping for multi-project workspaces.
enabled
bool
default:"True"
Set False to disable all tracing (useful in tests).
agent_name
str
default:"None"
Default agent name for all traces. Auto-detected from framework if not set.

Instrumentation flags

All instrumentation flags are bool, default False. Pass True to auto-instrument that surface. 8 framework integrations plus 3 direct LLM providers. Framework integrations
FlagInstrumentsType
openai_agentsOpenAI Agents SDKbool
langchainLangChain / LangGraphbool
llamaindexLlamaIndex (v0.10.20+)bool
crewaiCrewAI (via OpenTelemetry)bool
autogenAutoGen / AG2 (via OpenTelemetry)bool
adkGoogle ADK (Agent Development Kit) — native plugin, Gemini-nativebool
claude_agent_sdkAnthropic Claude Agent SDK (claude-agent-sdk) — native pluginbool
otelGeneric OpenTelemetry span exporter for any frameworkbool
Direct LLM providers — auto-trace raw SDK calls with no framework in between. Don’t combine a direct-provider flag with a framework flag that already traces the same provider (e.g. openai with openai_agents or langchain) or the call is captured twice.
FlagInstrumentsType
openaiDirect OpenAI SDK callsbool
anthropicDirect Anthropic SDK callsbool
googleDirect Google GenAI (google.genai) SDK callsbool

Other parameters

verify
bool
default:"True"
If True (the default), init() synchronously probes the backend once to validate the API key and detect a wrong or unreachable base_url. Raises DecimalConfigError on a 401/403 or a connection failure — failing loud at init beats a silent day of background-send 401s. Pass verify=False in CI or cold-start-sensitive paths where the ~50–200ms probe is unacceptable.
verify_timeout
float
default:"3.0"
Seconds before the verify probe gives up. On timeout, init() logs a warning and continues (does not raise), so a transiently slow backend doesn’t break startup.
Flag form vs explicit install() form. Passing a framework flag (langchain=True, openai_agents=True, …) is shorthand for init() + auto-running the matching install(). Use the explicit form only when you need to pass arguments to install(...) — e.g., install(agent=my_agent) for OpenAI Agents (full schema), or install(prompts={...}) for LangChain (override dynamic prompts). Don’t combine the two for the same framework — pick one or the other.

Environment Variables

VariableDescription
DECIMAL_API_KEYAPI key (alternative to api_key= parameter)
DECIMAL_BASE_URLBackend URL override
DECIMAL_AUTO_TRACEAuto-instrument on import. Values: langchain, openai-agents, adk, llamaindex, crewai, autogen, otel, openai, anthropic, google
Zero-code setup — set env vars and run your script with no code changes:
export DECIMAL_API_KEY="dai_sk_..."
export DECIMAL_AUTO_TRACE=openai-agents

python my_agent.py   # traces flow automatically

What’s next

Tracing

Decorators and helpers to capture LLM and tool calls.

Frameworks

8 framework integrations — OpenAI Agents, LangChain, LlamaIndex, CrewAI, AutoGen, OTel, plus native Google ADK and Anthropic Claude Agent SDK — explicit install() forms.