> ## Documentation Index
> Fetch the complete documentation index at: https://docs.decimal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Init & Setup

> Install the package, initialize the SDK, and configure environment variables. The starting point for every Python SDK user.

## Installation

```bash theme={null}
pip install decimalai
```

**Framework dependencies:**

```bash theme={null}
# 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

```python theme={null}
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.

```python theme={null}
decimalai.init(
    api_key="dai_sk_...",
    project="my-project",
    langchain=True,
)
```

<ParamField path="api_key" type="str" default="DECIMAL_API_KEY env">
  Your DecimalAI API key. Falls back to `DECIMAL_API_KEY` environment variable.
</ParamField>

<ParamField path="base_url" type="str" default="https://api.decimal.ai">
  Backend URL. Override for self-hosted deployments.
</ParamField>

<ParamField path="project" type="str" default="None">
  Optional project grouping for multi-project workspaces.
</ParamField>

<ParamField path="enabled" type="bool" default="True">
  Set `False` to disable all tracing (useful in tests).
</ParamField>

<ParamField path="agent_name" type="str" default="None">
  Default agent name for all traces. Auto-detected from framework if not set.
</ParamField>

### 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**

| Flag               | Instruments                                                           | Type   |
| ------------------ | --------------------------------------------------------------------- | ------ |
| `openai_agents`    | OpenAI Agents SDK                                                     | `bool` |
| `langchain`        | LangChain / LangGraph                                                 | `bool` |
| `llamaindex`       | LlamaIndex (v0.10.20+)                                                | `bool` |
| `crewai`           | CrewAI (via OpenTelemetry)                                            | `bool` |
| `autogen`          | AutoGen / AG2 (via OpenTelemetry)                                     | `bool` |
| `adk`              | Google ADK (Agent Development Kit) — **native** plugin, Gemini-native | `bool` |
| `claude_agent_sdk` | Anthropic Claude Agent SDK (`claude-agent-sdk`) — **native** plugin   | `bool` |
| `otel`             | Generic OpenTelemetry span exporter for any framework                 | `bool` |

**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.

| Flag        | Instruments                                    | Type   |
| ----------- | ---------------------------------------------- | ------ |
| `openai`    | Direct OpenAI SDK calls                        | `bool` |
| `anthropic` | Direct Anthropic SDK calls                     | `bool` |
| `google`    | Direct Google GenAI (`google.genai`) SDK calls | `bool` |

***

### Other parameters

<ParamField path="verify" type="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.
</ParamField>

<ParamField path="verify_timeout" type="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.
</ParamField>

<Note>
  **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.
</Note>

***

## Environment Variables

| Variable             | Description                                                                                                                                        |
| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DECIMAL_API_KEY`    | API key (alternative to `api_key=` parameter)                                                                                                      |
| `DECIMAL_BASE_URL`   | Backend URL override                                                                                                                               |
| `DECIMAL_AUTO_TRACE` | Auto-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:

```bash theme={null}
export DECIMAL_API_KEY="dai_sk_..."
export DECIMAL_AUTO_TRACE=openai-agents

python my_agent.py   # traces flow automatically
```

***

## What's next

<CardGroup cols={2}>
  <Card title="Tracing" icon="route" href="/sdk/python/tracing">
    Decorators and helpers to capture LLM and tool calls.
  </Card>

  <Card title="Frameworks" icon="layer-group" href="/sdk/python/frameworks">
    8 framework integrations — OpenAI Agents, LangChain, LlamaIndex, CrewAI, AutoGen, OTel, plus native Google ADK and Anthropic Claude Agent SDK — explicit `install()` forms.
  </Card>
</CardGroup>
