Trace Claude Code CLI sessions, tool usage, and token costs with Arize AX for full observability.Claude Code is Anthropic’s agentic coding tool that lives in your terminal. The Arize Claude Code Plugin instruments sessions using 9 hook events and sends OpenInference spans to Arize AX. Traces can be viewed in Arize.
Launch Arize
To get started, sign up for a free Arize account and get your Space ID and API Key:- Log in at app.arize.com
- Click Settings (gear icon) → copy the Space ID from the Space Settings page
- Go to the API Keys tab → click Create API Key or copy an existing one
Install
Install the Claude Code plugin from the Arize marketplace:
Restart Claude Code
Restart Claude Code for tracing to take effect:Observe
Now that you have tracing setup, all Claude Code sessions will be streamed to your Arize account for observability and evaluation. You’ll see:- Turn traces — each conversation turn (user prompt → assistant response)
- LLM spans — Claude’s responses with model info and token counts
- Tool spans — nested spans for each tool call with inputs, outputs, and duration
- Subagent spans — activity from any subagents Claude spawns
- Session grouping — all turns from the same session grouped by
session_id
Hooks Captured
| Hook | Captured Data |
|---|---|
SessionStart | Session ID, project name, timestamps |
UserPromptSubmit | Trace ID, prompt preview, transcript position |
PreToolUse | Tool ID, start time |
PostToolUse | Tool name, input, output, duration, metadata |
Stop | Model, token counts, input/output text |
SubagentStop | Agent type, model, token counts, output |
Notification | Title, message, notification type |
PermissionRequest | Permission type, tool name |
SessionEnd | Trace count, tool count |
Troubleshooting
| Problem | Fix |
|---|---|
| Traces not appearing | Check ARIZE_TRACE_ENABLED is "true" and API key / Space ID are correct |
| ”Python with opentelemetry not found” | Run pip install opentelemetry-proto grpcio |
| No output in terminal | Hook stderr is discarded; check /tmp/arize-claude-code.log |
| Want to test without sending | Set ARIZE_DRY_RUN to "true" |
| Want verbose logging | Set ARIZE_VERBOSE to "true" |