Quickstart
Python SDK
For Python agents that aren't behind a stock LLM SDK — custom orchestration, retrieval pipelines, agent frameworks.
If you call Anthropic or OpenAI directly, use the Anthropic or OpenAI patch instead — it's one line.
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 stasoPython 3.11+.
3. Decorate your agent
import staso as st
st.init(agent_name="support-bot")
@st.agent
def handle_ticket(ticket_id: str) -> str:
context = fetch_context(ticket_id)
return draft_reply(context)
@st.tool
def fetch_context(ticket_id: str) -> dict:
return db.lookup(ticket_id)@st.agent marks entry points. @st.tool marks tool functions. Both work with async def.
Open the Staso dashboard — every call to handle_ticket becomes a trace.
Multi-turn conversations
Group traces from one chat thread or background job under a single conversation_id:
with st.conversation("user-42-chat-7", user_id="user-42"):
handle_ticket("t-1")
handle_ticket("t-2")Next
- SDK reference —
init, decorators, manual spans, conversations, annotations. - Guard — block bad tool calls.
- HTTP API — non-Python ingest.