# Agent Dev Labs Capture & Replay > Records the LLM calls your app makes through an OpenAI or Anthropic client and replays them, so development and CI stop paying for repeat calls. Your provider key stays with your app. ## Before you start - If `AGENT_DEV_LABS_TOKEN` isn't set in the project's `.env`, stop and ask the user for it. Never create a token or write one into code, and never commit `.env`. - Leave `AGENT_DEV_LABS_MODE` unset unless the user asks. It outranks the devkit toggle. - Install with the project's own package manager. - If the user wants this saved for their agent, suggest `npx agentdevlabs skill install`. - The SDK reads the process environment, not `.env` itself. Make sure the app loads `.env`: in JavaScript run it with `node --env-file=.env`; in Python call `load_dotenv()` from python-dotenv before the client is wrapped, or export the variable. ## Install - JavaScript or TypeScript: `npm install agentdevlabs`, or the pnpm, yarn or bun equivalent the project uses. Needs ESM and Node 22.12 or later, and the provider SDK (`openai`, or `@anthropic-ai/sdk` 0.50.1 or later) installed alongside. - Python: `pip install agentdevlabs`, with the provider SDK (`openai` or `anthropic`) installed alongside. ## Wrap the client `adl` is required for a client your code creates. Do it where the client is created; the rest of the app keeps using the client as before. ```ts import OpenAI from 'openai' import { adl } from 'agentdevlabs' const client = adl(new OpenAI()) ``` ```ts import Anthropic from '@anthropic-ai/sdk' import { adl } from 'agentdevlabs' const client = adl(new Anthropic()) ``` ```py import openai from agentdevlabs import adl client = adl(openai.OpenAI()) ``` ```py import anthropic from agentdevlabs import adl client = adl(anthropic.Anthropic()) ``` ## LangChain, LangGraph, Deep Agents, and in JavaScript the Vercel AI SDK and Mastra These build their own provider clients, so there is nothing to wrap. Call `init()` once, first in the entry file in JavaScript, before any import that builds a client (a client built before it is not recorded), and at startup in Python. Leave the app otherwise unchanged. Do not also wrap their clients with `adl`. In strict replay a call with no capture answers 400: set `onFailure: "error"` on `modelRetryMiddleware`, and have Python's `with_retry` and `RetryPolicy` skip a 400. ```ts import { init } from 'agentdevlabs' init() ``` ```python from agentdevlabs import init init() ``` Optional: make one trace from a block with `trace(name, fn)` in JavaScript, or `with trace(name):` in Python. Name it with a fixed string such as `checkout`: the name is stored as plain text and shown to your workspace, so never put user data in it. A trace without a name shows its first prompt. ## Settings Environment variables only. Only the token is required. - `AGENT_DEV_LABS_TOKEN`: your workspace token. Put it in `.env`; never commit it. - `AGENT_DEV_LABS_MODE`: optional. `auto`, `capture`, `replay` or `off`. Overrides the server's mode. - `AGENT_DEV_LABS_DISABLED`: optional. `1` turns the SDK off and beats every other setting. - `AGENT_DEV_LABS_VERBOSE`: optional. `1` prints one line per call to standard error, for the check below. Unset it after. - `AGENT_DEV_LABS_GROUP`: optional. Names a trace group: calls are captured into it and replays use only its recordings. ## Check it works Run the app twice with `AGENT_DEV_LABS_VERBOSE=1`, letting each run exit on its own (a killed run loses its upload). Every call prints a line starting `[agentdevlabs]`: run 1 should print `captured` and run 2 `replayed`. - `passed-through`, `failed` or `not-stored`: the reason follows the word; read it. `not-stored` comes after `captured` when the server refused the capture, such as a token that can't capture. - `captured` on run 2: read the SDK's warnings, and look for a prompt that changes between runs, such as a date or an id. - No line: the call wasn't hooked; read the SDK's warning. Ask the user to open https://www.agentdevlabs.com/console/traces for the recorded trace and https://www.agentdevlabs.com/console/calls for the replayed calls only if that doesn't settle it. You can't sign in. ## CLI `npx agentdevlabs ` runs the CLI that comes with the JavaScript SDK. It needs Node 22.12 or later, also in a Python project, and is on every plan during the beta. `npx agentdevlabs --help` shows a command's options. - `login [--code]`: the user approves a login in the console, and the CLI keeps a personal token for one environment in the OS keychain, or in a private file when there is none. Ask the user to run it; you can't approve it. `login --code` shows a code to enter on any device, for SSH or a container. The app doesn't need it: the SDK reads `AGENT_DEV_LABS_TOKEN`. - `mode `: sets the mode of the environment the user logged in to, from the next trace. Use `replay` while you rerun the app to check your work, and `clear` when you are done. `AGENT_DEV_LABS_MODE` in the app still wins. Needs a personal token, which `login` gives: a service token can't set the mode, and production refuses it, since production always passes calls through. - `status`: prints the environment's mode, where it came from, and the pin. Run it before and after `mode`. - `logs [--follow]`: prints recent calls, one a line: time, `hit`, `miss`, `capture` or `error`, latency, provider, model and cost. Use it after a run to see which calls replayed. `--follow` keeps printing until Ctrl-C. - `replay [--group ] -- `: runs a command, such as the tests, with `AGENT_DEV_LABS_MODE=replay` (and `AGENT_DEV_LABS_GROUP` when `--group` is given). It exits with the command's exit code, so a recording miss that stops the command fails the run. Needs `AGENT_DEV_LABS_TOKEN` in the environment, normally a `replay-only` service token; it doesn't read the login. - `skill install`: copies a skill that teaches coding agents the SDK and the CLI into the user's home folder (`~/.claude/skills` and `~/.agents/skills`), never the project. Run it again after upgrading `agentdevlabs`. A shell that exports `AGENT_DEV_LABS_TOKEN` uses it instead of the login for `mode`, `status` and `logs`. With a service token there, `mode` fails with "only with a personal token": run it without the variable, as in `env -u AGENT_DEV_LABS_TOKEN npx agentdevlabs mode replay`, or ask the user to. ## Docs - [JavaScript SDK](https://www.agentdevlabs.com/docs/js.md) - [Python SDK](https://www.agentdevlabs.com/docs/python.md) - [SDK reference, every function, option and setting](https://www.agentdevlabs.com/docs/reference) ## Product facts - What it is: a hosted record-and-replay SDK for OpenAI and Anthropic calls. Each call is captured once and replayed after that with zero provider requests and the same answer every time. - Who it is for: teams and coding agents building and testing LLM apps, agents and harnesses, by hand or in CI/CD. - Not for: production traffic (calls from real users always go to the provider) or evals (they need fresh answers). - Languages: JavaScript or TypeScript (ESM, Node 22.12 or later) and Python. - Frameworks: LangChain, LangGraph, Deep Agents, and in JavaScript the Vercel AI SDK and Mastra, via `init()`. - Pricing: free during the beta, no payment details. Plans after the beta: Free $0, Basic $20, Pro $60, Max $180 a month, each with a monthly allowance of replay savings. Billing has not started. Details: https://www.agentdevlabs.com/pricing - Data: the SDK removes provider API keys, auth headers, tool-server credentials and known secret patterns before upload. Captures are encrypted in transit and at rest. - Packages: https://www.npmjs.com/package/agentdevlabs and https://pypi.org/project/agentdevlabs/ ## Site pages in Markdown - [Home](https://www.agentdevlabs.com/index.md): Agent Dev Labs records each LLM call once, then replays it while your team builds and tests: no provider cost and the same answer every time. - [Pricing](https://www.agentdevlabs.com/pricing.md): Free, Basic, Pro and Max plans for Agent Dev Labs Capture & Replay. Free during the beta; joining a paid plan's waiting list charges nothing. - [Docs](https://www.agentdevlabs.com/docs.md): Install the Agent Dev Labs SDK for JavaScript or Python, read the changelog, and find the Markdown docs for agents. - [SDK reference](https://www.agentdevlabs.com/docs/reference.md): Every function, option, report field and environment setting of the Agent Dev Labs JavaScript and Python SDKs. - [Changelog](https://www.agentdevlabs.com/changelog.md): What changed in each release of the Agent Dev Labs JavaScript and Python SDKs. - [Security](https://www.agentdevlabs.com/security.md): How to report a vulnerability in Agent Dev Labs, and what we protect. - [Privacy](https://www.agentdevlabs.com/privacy.md): What Agent Dev Labs Capture & Replay keeps, where it is kept, and how to have it deleted. - [Terms](https://www.agentdevlabs.com/terms.md): The terms for using Agent Dev Labs Capture & Replay. ## Blog - [How to stop paying for the same LLM call twice while you build and test](https://www.agentdevlabs.com/blog/stop-paying-for-repeat-llm-calls.md): Record each OpenAI or Anthropic call once, then replay it during development and in CI: zero provider cost, the same answer every time, and no mocks to maintain. ## Optional - [Everything above in one file](https://www.agentdevlabs.com/llms-full.txt) - [Sitemap](https://www.agentdevlabs.com/sitemap.xml)