Statewave Examples

June 17, 2026 · View on GitHub

CI License: Apache 2.0

Runnable demos for Statewave — memory runtime for AI agents, purpose-built for support-agent workflows.

Part of the Statewave ecosystem: Server · Python SDK · TypeScript SDK · Docs · Examples · Website + demo · Admin

📋 Issues & feature requests: statewave/issues (centralized tracker)

Try it in 2 minutes

New to Statewave? Start the server first with the Getting Started guide (Docker Compose, ~5 minutes), then run any example here against it. The docker compose up -d below is a shortcut that builds the API from a sibling ../statewave checkout in this workspace.

# 1. Start Statewave (Postgres + API server) — builds the API from ../statewave
docker compose up -d

# 2. Pick a language
pip install statewave            # Python
npm install                         # TypeScript (uses @statewavedev/sdk)

# 3. Run the quickstart
python minimal-quickstart/quickstart.py
# or
npx tsx minimal-quickstart/quickstart.ts

To run the core Python demos (quickstart, support agent, coding agent, eval suite) in sequence: ./try-it.sh

Examples

ExampleLanguagesWhat it shows
minimal-quickstartPython · TSRecord episodes → compile memories → retrieve context → delete
support-agent-pythonPython · TSReturning customer recognised across sessions, ranked context with token budget, provenance tracing, handoff pack
coding-agent-pythonPython · TSMulti-session project memory — tech stack, preferences, architecture decisions persist
support-agent-docsPythonDocs-grounded support agent using the statewave-support-docs memory pack
support-agent-llmPythonFull loop with a real LLM (LiteLLM, any provider) — stateless vs memory-powered side by side
eval-support-agentPython (pytest)56 assertions across 23 tests covering context quality, handoff pack, session-aware ranking, health scoring, provenance, determinism
benchmark-support-agentPythonStatewave vs history stuffing vs simple RAG (TF-IDF) on recall, tokens, and provenance · plus a workflow benchmark on health-aware handoff
langchain-quickstartPythonStatewaveMemory(BaseMemory) — drop-in LangChain memory backed by Statewave's ranked, token-bounded, provenance-tagged retrieval
crewai-quickstartPythonInject a Statewave context bundle into a CrewAI Task description; record the Crew's output back as an episode
autogen-quickstartPythonWeave a Statewave context bundle into an AutoGen AssistantAgent's system_message (refresh per turn for multi-turn chats)
chat-react-standaloneTypeScript · ReactStandalone chat app using @statewavedev/chat-react — Vite frontend with StatewaveChatProvider, Express proxy server, OpenAI/Anthropic LLM

Configuration

All examples respect the same environment variables:

VariableDefaultDescription
STATEWAVE_URLhttp://localhost:8100Statewave server URL
STATEWAVE_API_KEYAPI key (if auth is enabled)

The LLM example also uses LLM_MODEL and the matching provider key (e.g. OPENAI_API_KEY).

Run the server another way

These examples talk to a Statewave server over HTTP — they don't care how it is hosted. The Getting Started guide is the canonical Docker Compose path; for a bare-metal / local Python setup, see the deployment guide. Point any example at a non-default server with STATEWAVE_URL.

What leaves the box?

By default (heuristic compiler, no embeddings) examples run fully local — no calls leave the Statewave server you're talking to. To use the LLM compiler or hosted embeddings, set STATEWAVE_COMPILER_TYPE=llm and matching API keys on the server. See Privacy & Data Flow.

License

Apache-2.0