MovenAIsitsdirectlyinthehotpathofyouragent'stoolcalls.Itdetectsrunawayloops,repeatedarguments,andcostspikesinrealtime—trippingthefusebeforeyourcreditcardmelts!
@moven/sdk.WhenanAIagentgetsstuckinaloop,itinvokestheexactsametoolwithnear-identicalargumentparametersoverandoveragain.Moventracksargumenthashesinrealtimeandpullstheplugonthe5thattempt!
Neverletasingleagentexecutionburn$50+oncomplexmulti-turnreasoningloops.Setadollarceiling,andMovencalculatestokenratespermodelinrealtime.
Whenanalertoccurs,Movendynamicallyroutesexecutiontoacheaperfallbackmodel(e.g.Gemini2.5Flash/GPT-4o-Mini).Oncetheagentcompletes3consecutivecleanturns,MovenautomaticallyrestorestheprimaryLLMmodel.
Whykillanagentcompletelywhenyoucanautomaticallyre-runitwith90%cheapertokencosts?MovenqueriesOpenRouter'sliveAPItopairexpensivefrontiermodels(GPT-4o,ClaudeSonnet,GeminiPro)withtheircheapestproviderfallbackautomatically!
"Switched agent execution seamlessly to gpt-4o-mini($0.15 / 1M tokens). Execution resumed without breaking production workflows."
SeewhathappenswhenanagententersarunawayloopwithvswithoutMovenCircuitBreaker.
Agent called check_inventory 5 times with identical SKU. Moven tripped the fuse in 12ms.
Stream reader aborted mid-flight. Threw catchable MovenKillError before dispatching next model call.
Total run cost: $1.50 instead of $240.00+. Instant Slack alert card sent to the engineering channel!
AdjusttheslidersbelowtoestimatehowmuchcashyoulosetounmonitoredAIagentloopseverymonth.
Intercepts ~750 runaway loops per month before model APIs bill your card.
Purein-memoryexecutionwrapper+optionalhostedAPIdashboard
Lightweight npm package (@moven/sdk). Zero backend dependencies.
Tracks per-run tool call counts, argument hashes, cumulative token costs, recursion depth, and turn state hashes.
Synchronous heuristic checks after each tool call. On limit breach, halts stream or throws catchable MovenKillError.
If MOVEN_API_KEY is set, posts trip logs to Next.js API + Supabase for Slack/Email alerting.
Wrap tool definitions inside generateText or streamText to enforce circuit breaker limits.
import { createMovenCircuitBreaker } from '@moven/sdk';
import { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
// 1. Initialize Circuit Breaker
const breaker = createMovenCircuitBreaker({
maxRepeatCalls: 5, // Trip if tool called 5x in 60s
maxCostDollar: 2.00, // Trip if cumulative token cost > $2.00
apiKey: process.env.MOVEN_API_KEY, // Optional hosted dashboard
});
// 2. Wrap tool definitions
const result = await generateText({
model: openai('gpt-4o'),
prompt: 'Sync inventory with database',
tools: breaker.wrapTools({
updateInventory: {
execute: async (args) => { /* tool logic */ }
}
})
});Copy and paste this exact prompt into your AI coding assistant to automatically install & instrument @moven/sdk!
I want to instrument Moven AI Circuit Breaker (@moven/sdk) in my codebase to prevent infinite tool loops and cost spikes.
Please perform the following steps:
1. Run `npm install @moven/sdk`
2. In my AI agent files (where `streamText` or `generateText` from 'ai' is used):
- Import `createMovenCircuitBreaker` from '@moven/sdk'.
- Initialize the circuit breaker:
const breaker = createMovenCircuitBreaker({
apiKey: 'moven_sk_live_demo123',
maxRepeatCalls: 5,
maxCostDollar: 2.00,
maxDepth: 15,
});
- Wrap each tool execution inside `breaker.wrapTool('tool_name', async (args) => { ... })`.
- Wrap the main execution in a try/catch block for `MovenKillError` to safely return a fallback message if the fuse trips.RealteamsrunningLLMagentsinproductionwithMovenCircuitBreaker.
"OurLangGraphsupervisorgotstuckina140-steprepeatcallloopat2AM.Movenkilleditatstep5andsavedus$180overnight.Must-haveforproduction!"
"Weinstalled@moven/sdkin4minutes.Standalonemodeworksofflinewith0config.Finally,peaceofmindwhendeployingautonomousagents."
"Othertoolsshowyouthe$300billafterithappens.Movensitsinthehotpathandpullstheplugin10ms.Absolutelifesaver!"
"ThecostceilingrulealonesavedmycreditcardtwicethisweekwhenanLLMhallucinatedinvalidsearchsyntaxinaloop.10/10."
Existingtoolsshowyouwhathappenedafterthebillarrives.Movenstopsthedamagebeforeithappens.
| Feature / Capability | Moven AI | LangSmith | Langfuse | Helicone |
|---|---|---|---|---|
Hot-Path Circuit Breaker (Real-time Mid-Flight Kill) Halts stream or throws error BEFORE next LLM call executes | Yes | |||
Zero Backend Standalone Mode (Free & Local) Works 100% in-memory with local console logs and no dashboard needed | Yes | |||
Repeat Tool Call Interception (5 calls in 60s) Intercepts same tool + near-identical argument loops | Yes | |||
Strict Dollar Cost Ceiling Enforcement ($2.00 limit) Trips circuit breaker when cumulative run cost breaches limit | Yes | |||
Post-Hoc Tracing & Spans Observability Records full tool execution tree & latency breakdown | Yes | |||
Instant Alerting via Webhooks & Slack on Kill Event Notifies team immediately when a runaway loop is killed | Yes |
EverythingyouneedtoknowaboutsettingupMovenAICircuitBreaker.