Deterministic record/replay for LLM agents
TraceForge

Replay. Debug. Reimagine.

Debug AI agents. Without replaying the chaos.

Record once. Replay deterministically. Fork any step. Find exactly where your AI agent went wrong.

Interactive demo

Record. Replay. Fork. Diff.

demo/agent.ts

          

    Illustrative session from the demo/agent.ts expense-audit agent.

    Deterministic Replay

    Serve recorded responses, exact SSE framing included, from a local SQLite journal. Offline, no API key, $0.

    Counterfactual Forking

    Rewrite any recorded response with fork --at and replay the alternate timeline, also offline.

    Execution Diff

    Compare two runs event by event and land on the first divergence.

    Quick start

    A few lines to wire in.

    import Anthropic from "@anthropic-ai/sdk";
    import { fromEnv } from "traceforge";
    
    const session = fromEnv();
    const client = new Anthropic({
      // replay never reaches the network, so a placeholder key works offline
      apiKey: process.env.ANTHROPIC_API_KEY ?? "offline-replay",
      fetch: session.fetch,
    });
    // wrap other non-determinism: await session.io("fx_rate", fetchRate)
    traceforge record -- node agent.js          # run live, journal everything
    traceforge replay <run> -- node agent.js    # re-run offline
    traceforge fork <run> --at 46 --text …      # rewrite step 46
    traceforge diff <run> <fork>                # where the futures diverge