Skip to main content
This integration is only for Agent tracing. If you are looking for the Anthropic integration with the AI gateway, please see the Anthropic integration.
Give us a star on GitHub!
The Anthropic Agent SDK enables you to build agentic workflows powered by Claude. Keywords AI provides a TypeScript/JavaScript exporter that automatically captures and sends traces from the Anthropic Agent SDK to Keywords AI for monitoring, debugging, and optimization.

Quickstart

Install the exporter, then configure it to send traces to Keywords AI.

Prerequisites

npm install @respan/exporter-anthropic-agents
Set up your environment variables:
.env
RESPAN_API_KEY=YOUR_KEYWORDSAI_API_KEY
RESPAN_BASE_URL=https://api.keywordsai.co
VariableRequiredDescription
RESPAN_API_KEYYesYour Keywords AI API key
RESPAN_BASE_URLNoBase URL for Keywords AI. Defaults to https://api.keywordsai.co. Pass as endpoint constructor param with /api/v1/traces/ingest appended.
If you are on the enterprise platform, please use your enterprise endpoint as the base URL.

Hello World example

import { RespanAnthropicAgentsExporter } from "@respan/exporter-anthropic-agents";

const exporter = new RespanAnthropicAgentsExporter();

for await (const message of exporter.query({
  prompt: "Review this repository and summarize architecture.",
  options: {
    allowedTools: ["Read", "Glob", "Grep"],
    permissionMode: "acceptEdits",
  },
})) {
  console.log(message);
}

Using a custom endpoint

const baseUrl = process.env.RESPAN_BASE_URL || "https://api.keywordsai.co";

const exporter = new RespanAnthropicAgentsExporter({
  endpoint: `${baseUrl}/api/v1/traces/ingest`,
});

Configuration

All configuration can also be passed directly to the constructor, which takes priority over environment variables:
const exporter = new RespanAnthropicAgentsExporter({
  apiKey: "your_keywordsai_key",                              // Overrides RESPAN_API_KEY
  endpoint: "https://api.keywordsai.co/api/v1/traces/ingest", // Full ingest endpoint URL
  timeoutMs: 15000,
  maxRetries: 3,
  baseDelaySeconds: 1,
  maxDelaySeconds: 30,
});