Quickstart
Anthropic
One patch call. Every messages.create becomes an LLM span — sync, async, streaming.
1. Get an API key
Sign in to Staso and create a key under Settings -> API Keys. Export it:
export STASO_API_KEY=ak_...2. Install
pip install "staso[anthropic]"Python 3.11+.
3. Patch and go
import staso as st
from staso.integrations import patch_anthropic
import anthropic
st.init(agent_name="my-agent")
patch_anthropic()
client = anthropic.Anthropic()
client.messages.create(
model="claude-sonnet-4-5",
max_tokens=256,
messages=[{"role": "user", "content": "hi"}],
)Open the Staso dashboard — the call shows up as an LLM span with model, tokens, and latency.
What it captures
- Tokens (input, output, cache read, cache creation).
- Request params (model, temperature, max_tokens, top_p, stop_sequences, tool_choice, thinking).
- Response (content blocks, tool use, thinking, stop_reason, response_id).
- Streaming (
stream=Trueandmessages.stream(...)both wrapped).
Guard
Guard evaluates every tool_use block in the response. Blocked tools raise staso.GuardBlocked; modified tools have their input rewritten in place. See error handling.
Tool spans
Wrap your tools with @st.tool to capture their inputs and outputs as child spans:
@st.tool
def search_faq(query: str) -> str:
return db.search(query)See Python SDK quickstart for the full set of decorators.