Show HN: SteerPlane – open-source runtime guardrails for AI agents SteerPlane, an open-source runtime guardrails tool for AI agents, launched on Hacker News with features including cost limits, loop detection, and a policy engine to prevent infinite loops, runaway API costs, and destructive actions. The tool integrates with LangChain, OpenAI Agents SDK, CrewAI, and AutoGen, and offers a streaming gateway, CLI, Docker support, and a real-time dashboard. Runtime guardrails for autonomous AI agents. Cost limits · Loop detection · Dual enforcement Kill/Alert · Streaming gateway · Policy engine · Human-in-the-loop · CLI · Docker · 4 framework integrations pip install steerplane · npm install steerplane 🌐 steerplane.com AI agents can call APIs, execute code, browse the web, and make real-world decisions. Without guardrails: - 🔄 A single misconfigured agent can enter an infinite loop - 💸 A runaway agent can burn through $10,000+ in API credits overnight - 💀 Agents can take destructive actions with zero visibility SteerPlane fixes this with one line of code. python from steerplane import guard @guard agent name="support bot", max cost usd=10.00, max steps=50, denied actions= "delete ", "sudo " , enforcement="alert", alert threshold=0.8, alert timeout sec=1800, def run agent : Your agent runs normally. SteerPlane silently monitors every step. Financial/runtime limits can pause for human approval. Loops and policy violations still terminate immediately. agent.run 🚀 SteerPlane | Run Started Run ID: a3f8d2b1-... Agent: support bot Limits: $10.00 cost / 50 steps ───────────────────────────────────────────── ✅ Step 1: query database | 380 tokens | $0.0020 | 45ms ✅ Step 2: call llm analyze | 1240 tokens | $0.0080 | 320ms ✅ Step 3: search knowledge | 560 tokens | $0.0030 | 89ms ✅ Step 4: generate response | 1800 tokens | $0.0120 | 450ms ✅ Step 5: send notification | 120 tokens | $0.0010 | 200ms ───────────────────────────────────────────── ✅ SteerPlane | Run COMPLETED Steps: 5 Cost: $0.0260 Tokens: 4,100 Duration: 1.1s | Feature | What It Does | | |---|---|---| | 🔄 | Loop Detection | O W² sliding-window algorithm catches single-action, alternating, and multi-step repeating patterns in sub-millisecond time — no LLM calls | | 💰 | Cost Ceiling | Per-run SDK / per-session gateway USD limits, checked after each step so overshoot is bounded to a single step. Built-in pricing for 25+ models across OpenAI, Anthropic, Google, Meta, and Mistral | | 🌊 | Streaming Gateway | Real-time SSE chunk forwarding with mid-stream cost kill — if the budget is exceeded during a stream, SteerPlane injects a termination event and cuts the connection | | 🛡️ | Policy Engine | Allow/deny lists with glob patterns and sliding-window rate limits | | 🌐 | Gateway Proxy | OpenAI-compatible API proxy — change only base url for zero-code enforcement. The agent passes its provider key through the gateway, which forces all traffic through enforcement before forwarding upstream | | 🖥️ | Real-Time Dashboard | Next.js dashboard with auto-refresh, animated timelines, cost breakdowns, and policy management | | 🔧 | CLI Tool | steerplane runs list , steerplane status , steerplane keys create — manage everything from your terminal | | 📄 | Config File | .steerplane.yml auto-discovery — set defaults without hardcoding limits in source code | | 🔗 | 4 Framework Integrations | LangChain, OpenAI Agents SDK, CrewAI, AutoGen — zero-config drop-in handlers | | 🐳 | Docker Compose | One command brings up API + Dashboard + PostgreSQL | | 🔌 | Graceful Degradation | If the API goes down, the SDK enforces all limits locally. Agents are never unprotected | | 🧪 | CI/CD | GitHub Actions pipeline — lint, test, build Docker on every push | Hosted/Enterprise tier:alert-mode human-approval workflows with email/webhook notifications , server-side provider-key vaulting, and Redis-backed multi-worker gateway state are available on SteerPlane's hosted plan. The open-source SDK still exposes the enforcement="alert" client options so it works out of the box against a hosted or enterprise deployment — self-hosting only the free tier here runs kill-mode enforcement. git clone https://github.com/vijaym2k6/SteerPlane.git cd SteerPlane cp .env.example .env docker compose up -d API at localhost:8000 · Dashboard at localhost:3000 · PostgreSQL auto-configured. Install the SDK pip install steerplane Start the API cd api && pip install -r requirements.txt uvicorn app.main:app --reload --port 8000 Start the Dashboard cd dashboard && npm install && npm run dev pip install steerplane cli steerplane status Check API health steerplane runs list List recent runs steerplane keys create -n prod Generate API key python examples/simple agent/agent example.py Open localhost:3000 → See your agent run in real time. python from steerplane import guard @guard agent name="my bot", max cost usd=10.00, max steps=50, max runtime sec=300, enforcement="alert", alert threshold=0.8, denied actions= "delete ", "sudo " , allowed actions= "search ", "read ", "generate " , rate limits= {"pattern": "call llm ", "max count": 20, "window seconds": 60} , def run my agent : agent.run python from steerplane import SteerPlane sp = SteerPlane agent id="my bot" with sp.run max cost usd=10.0, max steps=50 as run: run.log step "query db", tokens=380, cost=0.002, latency ms=45 run.log step "generate", tokens=1240, cost=0.008, latency ms=320 js import { guard, GuardOptions } from 'steerplane'; const protectedAgent = guard async run = { await run.logStep { action: 'query db', tokens: 380, cost: 0.002 } ; await run.logStep { action: 'generate', tokens: 1240, cost: 0.008 } ; return 'done'; }, { agentName: 'support bot', maxCostUsd: 10.0, maxSteps: 50, policy: { deniedActions: 'delete ', 'sudo ' , }, } ; const result = await protectedAgent ; from steerplane.exceptions import CostLimitExceeded, LoopDetectedError, StepLimitExceeded, PolicyViolationError, @guard max cost usd=5, denied actions= "delete " def run agent : try: agent.run except CostLimitExceeded as e: print f"Budget exceeded: {e}" except LoopDetectedError as e: print f"Loop detected: {e}" except StepLimitExceeded as e: print f"Step limit hit: {e}" except PolicyViolationError as e: print f"Policy violation: {e.action} blocked by {e.rule}" Set defaults in a .steerplane.yml at your project root instead of hardcoding limits: api url: http://localhost:8000 agent name: my bot defaults: max cost usd: 25.0 max steps: 100 max runtime sec: 1800 enforcement: alert loop window size: 10 policy: denied actions: - "delete " - "drop " rate limits: - pattern: "search " max count: 10 window seconds: 60 alerts: email: ops@company.com webhook url: https://hooks.slack.com/... threshold: 0.8 Merge order: Explicit decorator params → .steerplane.yml → hardcoded defaults. The config file is auto-discovered by walking up from the current directory. python from steerplane.integrations.langchain import SteerPlaneCallbackHandler handler = SteerPlaneCallbackHandler agent name="research bot", max cost usd=5.0, max steps=30, llm = ChatOpenAI model="gpt-4o", callbacks= handler agent.run "Analyze this data", callbacks= handler handler.finish python from steerplane.integrations.openai agents import SteerPlaneAgentHooks hooks = SteerPlaneAgentHooks agent name="my openai agent", max cost usd=10.0, max steps=100, Convenience wrapper result = await hooks.run agent, "Hello " Or manual lifecycle hooks.start result = await Runner.run agent, "Hello " hooks.finish python from steerplane.integrations.crewai import SteerPlaneCrewMonitor monitor = SteerPlaneCrewMonitor agent name="my crew", max cost usd=25.0, max steps=200, crew = Crew agents= researcher, writer , tasks= research task, write task , step callback=monitor.step callback, result = monitor.kickoff crew python from steerplane.integrations.autogen import SteerPlaneAutoGenMonitor monitor = SteerPlaneAutoGenMonitor agent name="my autogen group", max cost usd=15.0, max steps=150, result = monitor.initiate chat user proxy, assistant, message="Hello " Install only the integration you need: pip install steerplane langchain LangChain pip install steerplane cli CLI tool pip install steerplane yaml Config file support pip install steerplane all Everything For agents you can't modify, SteerPlane provides an OpenAI-compatible gateway proxy with real-time streaming and mid-stream cost enforcement : python from openai import OpenAI client = OpenAI base url="http://localhost:8000/gateway/v1", api key="sk sp your steerplane key", The real provider key is sent to the gateway, which forwards it upstream. default headers={"X-LLM-API-Key": "sk-your-real-provider-key"}, Streaming works — chunks forwarded in real-time for chunk in client.chat.completions.create model="gpt-4o", messages= {"role": "user", "content": "Hello"} , stream=True, : print chunk.choices 0 .delta.content, end="" What the gateway enforces per request: - Policy rules deny/allow/rate limits - Session cost vs. ceiling including mid-stream kill - SHA-256 prompt-hash loop detection - Monthly budget tracking - Anthropic + OpenAI streaming support Security model: The agent points its OpenAI client at the gateway and passes the real provider key in the X-LLM-API-Key header. The gateway authenticates the SteerPlane key, runs every request through enforcement policy → cost → loop , and only then forwards it upstream with that provider key — so the agent can't reach the provider directly or bypass the guardrails. Server-side provider-key vaulting so the agent never sends X-LLM-API-Key is available on the hosted/enterprise plan. pip install steerplane cli | Command | Description | |---|---| steerplane status | Check API server health | steerplane runs list | List recent runs filter by --status | steerplane runs inspect