Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tracepilot.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

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.

Quick Start

Install the SDK and send your first trace in under 5 minutes.

Authentication

Get your API key and configure the SDK for your environment.

Time-Travel Debugging

Learn how to fork and re-run any failing span from the dashboard.

SDK Reference

Full reference for TracePilot, wrapOpenAI, and wrapToolCall.

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

Install the SDK

npm install tracepilot-sdk
2

Get your API key

Sign in at tracepilotai.com with GitHub or Google. Your key starts with tp_live_.
3

Wrap your first agent

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
);
4

Open the dashboard

Visit tracepilotai.com/dashboard — your trace is already there. Click any span to inspect it, or hit Fork & Rerun to edit and replay.

Key features

Execution Tracing

Every LLM call and tool invocation captured as a structured span tree.

Time-Travel Forking

Edit any span’s input and re-execute from that exact point.

Token & Cost Tracking

Per-span token usage and estimated API cost in real time.

Destructive Call Warnings

Flag tool calls that modify external state before they cause problems.