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

# Instrument your agent

> Connect any supported agent framework to Failproof AI with one call.

Your agent already produces everything worth recording — model calls, tool calls, node boundaries, human waits, failures. The framework throws it away. The SDK keeps it.

<Columns cols={3}>
  <Card title="Custom agents" icon="wrench" href="/start/quickstarts/custom-agents">
    An agent you wrote yourself, or one not listed here.
  </Card>

  <Card title="LangChain and LangGraph" icon="share-2" href="/start/quickstarts/langchain">
    Graphs, nodes, tools, retrievers, models.
  </Card>

  <Card title="CrewAI" icon="users" href="/start/quickstarts/crewai">
    Crews, flows, agents by role, tools.
  </Card>

  <Card title="LlamaIndex" icon="database" href="/start/quickstarts/llamaindex">
    Workflows, steps, function agents, retrievers.
  </Card>

  <Card title="Pydantic AI" icon="badge-check" href="/start/quickstarts/pydantic-ai">
    Typed agents, capabilities, tools, retries.
  </Card>
</Columns>

## Before you start

Two things this path assumes, neither of which the code below does for you:

| Requirement                                | Why                                                                                                                                                                                    |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Python 3.10 or newer                       | The floor the SDK declares.                                                                                                                                                            |
| A machine set up with `failproofai config` | That command installs the failproofaid daemon, and the daemon is the only thing that ships what the SDK writes. Without it the batches pile up in the spool directory and never leave. |

<Note>
  **This path records; it does not enforce.** The SDK captures what your agent did. Policies fire from a hook inside an agent CLI, so enforcing on a framework agent means putting a hook in your own runtime — see [Policies](/policies/overview).
</Note>

## Three lines, whichever framework

<CodeGroup>
  ```bash LangGraph theme={null}
  pip install 'failproofai-sdk[langgraph]'
  ```

  ```bash CrewAI theme={null}
  pip install 'failproofai-sdk[crewai]'
  ```

  ```bash LlamaIndex theme={null}
  pip install 'failproofai-sdk[llamaindex]'
  ```

  ```bash Pydantic AI theme={null}
  pip install 'failproofai-sdk[pydantic-ai]'
  ```

  ```bash Custom agents theme={null}
  pip install failproofai-sdk
  ```
</CodeGroup>

```python theme={null}
import failproofai_sdk

failproofai_sdk.configure(environment="production")
failproofai_sdk.instrument()          # detects the frameworks you imported

with failproofai_sdk.session():
    ...                               # your existing agent call, unchanged
```

No decorators on your functions, no callback passed to your calls, no ids threaded through your code. Only the call inside the session differs:

<Tabs>
  <Tab title="LangGraph">
    ```python theme={null}
    graph.invoke({"messages": [HumanMessage("...")]})
    ```
  </Tab>

  <Tab title="CrewAI">
    ```python theme={null}
    Crew(agents=[analyst, writer], tasks=[gather, summarise]).kickoff()
    ```
  </Tab>

  <Tab title="LlamaIndex">
    ```python theme={null}
    await agent.run("...")        # under `async with failproofai_sdk.session():`
    ```
  </Tab>

  <Tab title="Pydantic AI">
    ```python theme={null}
    agent.run_sync("...")
    ```
  </Tab>

  <Tab title="Custom agents">
    ```python theme={null}
    with failproofai_sdk.agent("planner"):
        with failproofai_sdk.tool_call("search", input={"q": q}) as t:
            t.output = search(q)
    ```
  </Tab>
</Tabs>

The extra installs the **framework**. Every adapter ships in the base wheel, so a project that already has its framework needs no extra at all.

## Check it arrived

Run one instrumented session, then open **Observe → Sessions** and select your environment. The run appears as a reconstructed trace.

If nothing arrives, confirm the machine is set up and connected with `failproofai config --status`. If it is not, run `failproofai config`. See [Choose your setup](/start/setup).

<Warning>
  Do not check the spool directory to confirm delivery. The Failproof daemon collects and deletes each batch within milliseconds, so reading it races the collector and shows far fewer events than were emitted.
</Warning>

To prove the SDK is writing at all, stop the daemon first, then run your session and look in `~/.failproofai/custom-agents/events/`. With the daemon running, an empty directory is the healthy state.

<CodeGroup>
  ```bash Linux theme={null}
  sudo systemctl stop failproofaid@$USER
  ```

  ```bash macOS theme={null}
  sudo launchctl bootout system/ai.failproof.failproofaid.$USER
  ```
</CodeGroup>

Run `failproofai config` afterwards to put it back. While the daemon is stopped, hook events on this machine have no evaluator and are denied, so stop it only for as long as the check takes.

## Next

Each quickstart above links to its full guide — what gets recorded, options, streaming, span naming, and the problems people actually hit. They live under **Trace Agents → Plug in your agent**.

<Columns cols={3}>
  <Card title="How it works" icon="workflow" href="/start/integrations/custom-agents#going-deeper">
    The data model, the ids, the event types, and how events reach Cloud.
  </Card>

  <Card title="Read a trace" icon="route" href="/sessions/read-a-trace">
    Follow causality through a session instead of disconnected logs.
  </Card>

  <Card title="Find your first failure" icon="scan-search" href="/start/first-audit">
    Audit the sessions you just captured.
  </Card>
</Columns>
