Skip to main content

wrapClaudeAgentSdk

wrapClaudeAgentSdk<T>(sdk): T Manually instrument the @anthropic-ai/claude-agent-sdk module. Reach for this when automatic instrumentation doesn’t apply — e.g. a bundler whose module loading the CJS/ESM hooks can’t observe, or an import path they don’t cover. Requires @anthropic-ai/claude-agent-sdk >= 0.3.178. Returns a view of the module whose query export is traced; use the returned object rather than the original import (the SDK’s query is a getter-only export, so the original binding can’t be patched in place):

Type parameters

Name
T

Parameters

NameType
sdkT

Returns

T Example
import * as  from '@anthropic-ai/claude-agent-sdk';
import {  } from 'weave';

const {  } = ();
for await (const  of ({ : 'hi' })) {
  // ...traced
}

Defined in

src/integrations/claudeAgentSdk.ts:209