Open Source

The stateful control plane
for AI agents

Track, secure, and optimize every agent run with absolute visibility and control — not just individual LLM calls.

pip install stateloom

Standard gateways see isolated calls

They miss the bigger picture. Your agent makes 50+ calls per run — each invisible to the last.

🔍

StateLoom sees entire sessions

Session-aware middleware groups calls into meaningful workflows. Resume crashed runs, enforce budgets, contain rogue agents.

🔒

Zero-trust data sovereignty

Runs on your laptop or inside your VPC. Your data never passes through a third-party proxy.

Everything you need to govern AI agents

Free and open source for individual developers. Enterprise features for teams at scale.

💰

Cost Control

Session-scoped cost tracking with per-model breakdown. Hard budget enforcement stops runaway agents before they drain your wallet.

🛡

PII Detection & Guardrails

Detect emails, credit cards, SSNs, API keys. 32 heuristic injection patterns, NLI classifier, and Llama-Guard support.

🔄

Durable Resumption

Temporal-like checkpointing. Agent crashes mid-run? Restart and resume from cache — no repeated API calls, no wasted spend.

🤖

Local Models & Auto-Routing

Run Ollama models locally. Intelligent routing sends simple requests to local models and complex ones to the cloud.

Caching & Performance

Exact-match and semantic caching. Loop detection catches spinning agents. Circuit breaker with automatic provider failover.

🧪

Model Testing & Experiments

Shadow-test candidates against production models. A/B experiments with built-in metrics. Multi-agent consensus (vote, debate, self-consistency).

🔌

Multi-Provider

Auto-patches OpenAI, Anthropic, Gemini, Cohere, Mistral, and LiteLLM. Mix providers freely in a single session.

📊

Live Dashboard

Session viewer with waterfall traces, cost breakdown, security controls, observability charts, and WebSocket streaming — all at localhost:4782.

🔧

CLI Agent Integration

Point Claude Code or Gemini CLI at StateLoom. Get full session tracking, PII scanning, and budget enforcement with zero code changes.

Get started in 3 lines

import stateloom
import anthropic

stateloom.init()
claude = anthropic.Anthropic()

with stateloom.session("customer-report", budget=2.0, durable=True) as s:
    research = claude.messages.create(
        model="claude-sonnet-4-20250514",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Key trends in AI governance 2025"}],
    )

    # If this crashes, restart → resumes from cache. No repeated calls.
    # Budget enforcement stops the run if it exceeds $2.
    print(f"Cost: ${s.total_cost:.2f} | {s.total_tokens} tokens")

Enterprise Edition

A centralized control plane to govern, secure, and optimize your entire AI workforce.

Governance & Billing

  • Hierarchical org/team token billing
  • Virtual Key management with scope enforcement
  • Automated chargebacks and budget controls
  • OAuth2/OIDC with RBAC (5 roles)

Security & Compliance

  • In-memory secret vault
  • CPython audit hooks (PEP 578)
  • GDPR / HIPAA / CCPA compliance profiles
  • Global kill switch with granular rules

Scale & Operations

  • Multi-agent consensus (vote, debate, judge)
  • A/B experiments with backtesting
  • Dark launch model validation
  • Blast radius containment

Book an Enterprise Demo

See how StateLoom can secure and optimize your AI infrastructure. We'll walk you through a live demo tailored to your use case.