Skip to content

Kibitz documentation

From zero to an inspectable agent trace

Choose the capture path that matches your agent. Each quickstart ends with a trace visible in the workspace and links to the operating mode for your scale.

See your first trace in 5 minutes

Run the app, import recent coding-agent work, and verify the result in Traces.

1. Start the workspace

terminal
git clone <your-kibitz-repository>
cd kibitz
pnpm --dir web install
pnpm --dir web dev

2. Import recent sessions

terminal
cd agent
uv sync
uv run python -m kibitz_ingest.cli --source all --limit 8

3. Verify

Open /traces. Real data replaces the bundled demo data as soon as it is available.

/traces

Choose how the trace enters Kibitz

Native SDKs, OTLP, direct HTTP, and importers produce the same Run shape. Start with history import when evaluating Kibitz; use an SDK, OTLP, or --watch for continuous tracing.

Instrument code you own

A trace is one agent run. request() creates the human-intent boundary used to collapse long work; @tool and span() record the observations below it.

agent.py
from kibitz_sdk import trace, tool

@tool
def search(query: str) -> list[dict]:
    return db.search(query)

with trace(
    "monthly-report",
    agent="sales-reporter",
    model="claude-opus",
    session_id="session-42",
    user_id="user-7",
    tags=["production"],
) as run:
    with run.request("Summarize Q3 revenue"):
        rows = search("revenue 2026 Q3")
        run.answer(summarize(rows), input_tokens=1200, output_tokens=180)

Mark request boundaries

Wrap each user instruction so hours of work can be collapsed into meaningful groups.

Record tools and model work

Use @tool for functions or run.span() when you need explicit results, usage, and error state.

LangChain & LangGraph

Pass KibitzCallback(run) in callbacks. Prompt content is excluded unless record_prompts=True.

Import coding-agent sessions

The CLI discovers the most recently modified eligible Claude Code and Codex JSONL files, merges them by trace id, and caps a run at 2,000 captured observations by default.

terminal
# Both supported adapters
uv run python -m kibitz_ingest.cli --source all --limit 8

# One source, a custom root, and a larger cap
uv run python -m kibitz_ingest.cli \
  --source codex \
  --root ~/.codex/sessions \
  --max-turns 4000

Current adapter coverage

Claude Code, Codex, Langfuse observations_v2, Python, TypeScript, OTLP/HTTP JSON, and direct Run HTTP are implemented.

Send traces over HTTP

The endpoint accepts one Run or an array up to 8 MB. Set KIBITZ_INGEST_TOKEN before exposing it to a network.

terminal
export KIBITZ_INGEST_TOKEN="replace-me"

curl http://localhost:3000/api/traces \
  -H "Authorization: Bearer $KIBITZ_INGEST_TOKEN" \
  -H "Content-Type: application/json" \
  --data-binary @trace.json

How Kibitz organizes a long run

The raw execution tree remains intact; additional objects make the outcome understandable.

  1. 01Trace — one complete agent run
  2. 02Request group — one user intent and all work until the next request
  3. 03Observation — model, tool, retrieval, sub-agent, or event
  4. 04Finding — deterministic heuristic, evidence, and counterfactual

Privacy defaults

Agent traces may contain prompts, file paths, tool arguments, and outputs. Treat the trace directory as sensitive application data.

  • LangChain prompt recording is off by default
  • Model-based suggestions are optional and preview the exact brief before sending
  • Use ingest and read tokens whenever the server is reachable outside localhost

Self-host with persistent trace storage

Docker Compose stores runtime traces and durable resources in the kibitz-data volume. Back up that volume before upgrades.

terminal
cp .env.example .env
# Set KIBITZ_INGEST_TOKEN and KIBITZ_READ_TOKEN in .env
docker compose up -d

# Runtime traces persist in the kibitz-traces volume
docker compose ps

Choose the collection and deployment mode that fits

  • Local readable files for evaluation, or shared RWX trace/resource directories for stateless web replicas
  • Python ContextVar and TypeScript AsyncLocalStorage keep concurrent tasks isolated
  • OTLP/HTTP JSON receiver and Langfuse observations_v2 JSON/JSONL importer
  • Prompt, dataset, evaluator, queue, and automation resources persist through a CRUD API
  • Code-agent import runs once or continuously with --watch

Repository guides

Detailed configuration, SDK, ingestion, security, detection, and self-hosting guides live in the repository’s docs/ directory.