AgentwatchConsole
Getting started

Quickstart

From an untraced agent to a live trace in about two minutes.

  1. Install the SDK

    No peer dependencies and no build step — the package is the whole integration.

    npm install @agentwatch-beta/sdk
  2. Register 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.

  3. 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.ts
    import { 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 errors
  4. Run 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?

The SDK swallows delivery failures by design, so a wrong key fails silently rather than crashing your agent. Check that the key and the agent UUID belong to the same project, then set 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, or error if 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.