Skip to content

Anthropic SDK

@lookspan/anthropic wraps an Anthropic client so every messages.create call — including streaming — emits a Lookspan span. Same client type, identical behavior.

Terminal window
npm install @lookspan/anthropic
import Anthropic from '@anthropic-ai/sdk';
import { observeAnthropic } from '@lookspan/anthropic';
const anthropic = observeAnthropic(new Anthropic());
await anthropic.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages,
});
Method Span type
messages.create llm_call

Streaming is supported — the wrapper accumulates the streamed text into the span’s output and reads token usage from the response. Cost is computed server-side from the model name against Lookspan’s pricing table.

observeAnthropic(client, options) accepts the shared option bag. For example:

const anthropic = observeAnthropic(new Anthropic(), {
agentId: 'planner',
sessionId: 'run-2026-06-08',
});

Content is omitted by default. Set { captureContent: true } only when prompts and replies are safe to persist and you want Replay & judge for those spans.

Lookspan is part of Fervon, the autonomous software studio of Jonathan Martín — local-first developer tools built by fleets of AI agents.