Staso Docs
Integrations

Claude Code Integration

Trace your Claude Code sessions. Every turn, tool call, and LLM interaction shows up on your Staso dashboard -- with token usage, duration, and errors.

No code changes. One setup command.

Setup

pip install staso
uv pip install staso
staso setup --target claude-code \
  --api-key ak_... \
  --workspace my-workspace \
  --environment production \
  --agent-id my-agent

That's it. Start a Claude Code session and traces flow automatically.

What Shows Up on the Dashboard

Each conversation turn becomes a trace. Within each trace:

SpanKindWhat It Captures
Turn (root)agentTotal duration, prompt, final response
LLM callsllmModel, input/output tokens, cache tokens, duration
Tool callstoolTool name, input, output/error, exact execution duration
SubagentsagentAgent type, token usage, exact duration
API errorsagentError type (rate limit, auth, socket, billing), duration before failure

All turns from the same Claude Code session are grouped together on your dashboard.

Setup Options

FlagDescription
--api-key KEYStaso API key (ak_...). Falls back to STASO_API_KEY env var.
--workspace SLUGWorkspace identifier
--environment ENVEnvironment tag (default: production)
--agent-id IDAgent ID shown on dashboard
--scope {global,project}global writes to ~/.claude/settings.json, project writes to .claude/settings.local.json

Scope

staso setup --target claude-code --api-key ak_... --scope global

Traces every Claude Code session on your machine.

staso setup --target claude-code --api-key ak_... --scope project

Traces only sessions in the current project directory.

Environment Variables

The setup command writes these to your Claude Code settings automatically. You can also set them manually:

VariablePurpose
STASO_API_KEYAPI key for authentication
STASO_BASE_URLBackend URL (override for debugging)
STASO_WORKSPACE_SLUGWorkspace identifier
STASO_ENVIRONMENTEnvironment tag
STASO_AGENT_IDAgent ID on dashboard
STASO_DEBUGSet to 1 for debug logging

Upgrading

After upgrading the staso package, hook configuration updates automatically on the next session start. No need to re-run setup.

pip install --upgrade staso
uv pip install --upgrade staso

Re-running Setup

Safe to run multiple times. It replaces existing Staso hooks without affecting other hooks you've configured.

Disabling

Remove the Staso hooks from your Claude Code settings file (~/.claude/settings.json for global, .claude/settings.local.json for project). Delete the STASO_* entries from the env section and the Staso entries from the hooks section.