anthropic (Python) or @anthropic-ai/sdk (Node.js) client are captured automatically, including streaming, tool use, and extended thinking.
Prerequisites
- A Moda API key (created in the dashboard at Settings → Ingestion keys; shown once at creation)
- An Anthropic API key
- Python 3.10 or later, or Node.js 18 or later
- Node.js only:
@anthropic-ai/sdkversion 0.18.0 or later
Setup
1
Install the packages
2
Initialize Moda before creating the client
Initialize the SDK first, then construct the Anthropic client. Flush before your process exits so buffered data is sent.
3
Verify in the dashboard
Run the script, then open Conversations in the dashboard. You should see a conversation with ID
session_123 containing the user message and the assistant reply, with model claude-sonnet-4-20250514 and token counts. Analysis signals typically appear within minutes of ingest.Conversation grouping
Set a conversation ID before the first call of a session — from your session, thread, or run ID — so every call in the session lands in one conversation. Usemoda.conversation_id (Python) or Moda.conversationId / Moda.withConversationId() (Node.js). See the Python SDK and the Node.js SDK for the full context APIs.
Streaming
Bothmessages.stream() and messages.create(..., stream=True) are captured. The SDK records the complete response after the stream finishes, so consume the entire stream.
Tool use
Tool calls are captured automatically:tool_use blocks in assistant messages, and the tool_result blocks you send back in follow-up messages.
Extended thinking
When extended thinking is enabled, thinking content blocks are captured alongside the final text response, in both non-streaming and streaming calls.Support matrix
Troubleshooting
No conversations appear in the dashboard. Initialize Moda before constructing the Anthropic client, and callmoda.flush() (Python) or await Moda.flush() (Node.js) before the process exits. In Node.js, confirm Moda.init() is awaited and the API key starts with moda_sk_.
Streaming calls show no assistant message. The response is recorded only after the stream ends. Consume the stream fully; a stream that is abandoned partway is not captured completely.
Thinking blocks are missing. Extended thinking requires a model that supports it and the thinking parameter with type: "enabled" and a budget_tokens value.
Every request creates a new conversation. Set a conversation ID before the first call of the session (see Conversation grouping above).
Next steps
- Python SDK — init options, context managers, and instrument controls.
- Node.js SDK — init options, scoped context, and manual tracing.
- Amazon Bedrock — capturing Claude models served through Bedrock.
- Claude Agent SDK — capturing agents built on the Claude Agent SDK (Python).