Quickstart
From an untraced agent to a live trace in about two minutes.
Install the SDK
No peer dependencies and no build step — the package is the whole integration.
npm install @agentwatch-beta/sdkRegister an agent
Create an agent in the console and copy its UUID, then create an API key alongside it. One agent is one thing you want scored independently — a support bot and a RAG pipeline get their own baselines, not a shared one.
Wrap your agent function
watch()takes the function your agent already runs and returns one with the same signature. The first argument is captured as the trace input, the return value as the output.agent.tsimport { watch } from '@agentwatch-beta/sdk' const runAgent = watch(myAgentFn, { apiKey: process.env.AGENTWATCH_KEY!, agentId: process.env.AGENTWATCH_AGENT_ID!, }) const result = await runAgent(userQuery)same arguments · same return value · same thrown errorsRun it
Call your agent once. The trace is POSTed in the background, so the call returns at its usual speed and the trace lands a moment later. Refresh the console — the session appears under the agent you registered.
Nothing appearing?
debug: true to have the SDK report what it attempted.What gets captured
Every call produces one trace containing:
- The input — the first argument, truncated to
maxPreviewLength. - The output — the resolved return value, truncated the same way.
- Latency in milliseconds, measured around your function.
- Status —
success, orerrorif your function threw. - Model, token counts, and tool names, when the return value is an OpenAI-compatible response.
- Any tags you set in
metadata.
Next
Read watch() for the exact capture semantics, or Configuration for self-hosting and metadata tagging. If you call an OpenAI-shaped API, the integration page shows what comes back for free.