What is Moven?
AI agents fail expensively: a single recursive tool loop can burn hundreds of dollars overnight. Moven evaluates every tool call deterministically in-memory, before execution — no network hop, no proxy, no added latency. When a heuristic trips, Moven throws a typed MovenKillError, persists a full trace to your dashboard, and can time-travel rewind the agent to the last clean checkpoint.
Quick preview
Wrap any tool function with the breaker. That is the entire integration.
import { createMovenCircuitBreaker } from 'moven-sdk'; const moven = createMovenCircuitBreaker({ agentName: 'support-agent', maxRepeatCalls: 3, maxCostDollar: 2.0, provider: 'openrouter', currentModel: 'openai/gpt-4o-mini',}); // Any runaway call now trips in-process before it executesexport const runTool = moven.wrap(async (query: string) => { return db.execute(query);});
from moven_sdk import MovenCircuitBreaker, BreakerConfig breaker = MovenCircuitBreaker(BreakerConfig( project_id="your-project-id", max_repeats=3, spend_ceiling_usd=2.00, model_name="openai/gpt-4o",)) breaker.protectdef execute_sql_query(query: str): return db.execute(query)
How it works
Every tool call passes through a four-stage in-memory pipeline before your tool code ever runs:
- 1InterceptThe wrapTools() trap captures tool name, payload, timestamp and stack context.
- 2HashArguments are canonicalized (sorted keys) and SHA-256 hashed for exact repeat detection.
- 3EvaluateHeuristic layers run against sliding windows: repeats, cost, depth, no-progress, semantic fingerprints.
- 4Recover or killHealthy calls pass through. Loops trip the breaker, dispatch alerts and route to checkpoint rewind.
Telemetry (traces, spans, checkpoints, kill alerts) is dispatched asynchronously to api.moven.dev/events with retry and backoff — so a cloud outage never blocks your agent.
Core concepts
Webhooks & alerts
When a breaker trips, Moven instantly POSTs the offending tool parameters, trip reason and money-saved estimate to your configured Slack channels and custom HTTP webhooks. Alerts are also recorded per-trace in the dashboard under Kill Alerts, with optional email escalation for critical heuristics such as prompt injection.
Troubleshooting
Moven runs standalone. All circuit breaker rules keep evaluating in-memory and throw MovenKillError locally — the agent is protected even with zero connectivity.
No. Result-Delta Hashing distinguishes legitimate progress (a poll whose status changes) from stagnant loops, and safe-to-retry polling tools get their own TTL window.
Upgrade to the latest moven-sdk — recent versions report prompt/completion tokens and per-step cost with every completed (200 OK) run, and the backend falls back to model-pricing estimates when usage is missing.