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

# TracePilot AI — Debug Your AI Agents Like Software

> TracePilot AI captures every LLM call and tool invocation as a structured trace, so you can find failures fast and fix them without redeploying.

TracePilot AI is the debugging layer your AI agents have been missing. With one wrapper around your OpenAI calls, TracePilot captures every decision, token spend, and tool invocation — then lets you fork any failing step, edit the input, and re-run from that exact point in seconds. No guessing. No redeployment.

<CardGroup cols={2}>
  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Install the SDK and send your first trace in under 5 minutes.
  </Card>

  <Card title="Authentication" icon="key" href="/authentication">
    Get your API key and configure the SDK for your environment.
  </Card>

  <Card title="Time-Travel Debugging" icon="clock-rotate-left" href="/concepts/time-travel-debugging">
    Learn how to fork and re-run any failing span from the dashboard.
  </Card>

  <Card title="SDK Reference" icon="book" href="/reference/tracepilot">
    Full reference for TracePilot, wrapOpenAI, and wrapToolCall.
  </Card>
</CardGroup>

## How it works

TracePilot wraps your existing OpenAI and tool calls — it doesn't replace them. Every call is captured as a structured span with inputs, outputs, token counts, latency, and errors.

<Steps>
  <Step title="Install the SDK">
    ```bash theme={null}
    npm install tracepilot-sdk
    ```
  </Step>

  <Step title="Get your API key">
    Sign in at [tracepilotai.com](https://tracepilotai.com) with GitHub or Google. Your key starts with `tp_live_`.
  </Step>

  <Step title="Wrap your first agent">
    ```typescript theme={null}
    import { TracePilot } from 'tracepilot-sdk';
    import OpenAI from 'openai';

    const tp = new TracePilot('tp_live_YOUR_KEY');
    const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });

    await tp.startTrace('my-agent');

    const { result, spanId } = await tp.wrapOpenAI(
      () => openai.chat.completions.create({ model: 'gpt-4o-mini', messages }),
      messages
    );
    ```
  </Step>

  <Step title="Open the dashboard">
    Visit [tracepilotai.com/dashboard](https://tracepilotai.com/dashboard) — your trace is already there. Click any span to inspect it, or hit **Fork & Rerun** to edit and replay.
  </Step>
</Steps>

## Key features

<CardGroup cols={2}>
  <Card title="Execution Tracing" icon="diagram-project" href="/concepts/traces-and-spans">
    Every LLM call and tool invocation captured as a structured span tree.
  </Card>

  <Card title="Time-Travel Forking" icon="code-fork" href="/concepts/time-travel-debugging">
    Edit any span's input and re-execute from that exact point.
  </Card>

  <Card title="Token & Cost Tracking" icon="circle-dollar-to-slot" href="/concepts/cost-tracking">
    Per-span token usage and estimated API cost in real time.
  </Card>

  <Card title="Destructive Call Warnings" icon="triangle-exclamation" href="/guides/tracing-tool-calls">
    Flag tool calls that modify external state before they cause problems.
  </Card>
</CardGroup>
