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

# LangChain & LangGraph

> Auto-instrument LangChain chains, LangGraph state machines, and AgentExecutor / ReAct agents.

The LangChain integration installs as a LangChain callback handler. Every chain `invoke`, every LangGraph node, every tool call inside an AgentExecutor or ReAct loop is captured automatically.

## Install

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

## Use

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

# Or manual install:
from decimalai.langchain import install
install(agent_name="my-chain")

# All LangChain chains and agents are now traced
chain.invoke({"input": "Hello!"})
```

## What gets captured

* Chain / agent execution with all intermediate steps
* LLM calls with prompt templates **fully resolved** (not raw `{variable}` placeholders)
* Tool calls from `AgentExecutor`, ReAct loops, or LangGraph nodes
* Auto-detected manifest from tool schemas + model config

## Framework noise filtering

LangGraph and LangChain emit a lot of internal spans (`call_model`, `should_continue`, `Prompt`, `RunnableSequence`, etc.). The trace UI auto-collapses these by default; toggle **"Show internals"** in the waterfall header to reveal them.

## Overriding dynamic prompts

If your prompts are built at runtime (not stored in the chain config), pass them to `install()`:

```python theme={null}
from decimalai.langchain import install

install(
    agent_name="my-chain",
    prompts={"system": "You are an assistant for ACME Corp."},
)
```

## What's next

<CardGroup cols={2}>
  <Card title="Tracing guide" icon="route" href="/guides/tracing">
    What gets captured at each layer and how to enrich a trace.
  </Card>

  <Card title="Manifests" icon="layer-group" href="/sdk/python/manifests">
    Auto-detection caveats for LangGraph state graphs.
  </Card>
</CardGroup>
