Vibeleaderboard
← All Intel
Intel / article

Build Always On Ai Agent

Source
openrouter.ai
Author
OpenRouter editorial sitemap
Date
Why it matters

Shows how to bound an unattended with step and cost limits, human approval on risky tools, and a seen-ID file as memory. Per-check costs ($0.0003 to $0.0012) let you budget before deploying.

Key takeaways · AI-distilled
  • OpenRouter's SDK 0.11.0 checks stop conditions between rounds of tool calls, then makes one closing call with tools off, so a run can go a model call or two past its step or cost limit. At about $0.0004 per call, that overshoot is a fraction of a cent.
  • Story IDs join seen.json only when a run finishes, held in fetched.json until then. When the authors killed the process mid-run, the next run finished the digest from saved results; the tradeoff is that a crash after writing the digest can list a story twice.
  • The first build reused the conversation across checks, and each run cost slightly more as earlier checks were resent. Deleting state at the start of every new check keeps per-check cost flat, with seen.json carrying the needed memory.
  • In a failure test, an approved post ran and the next model call failed. The saved state stayed in_progress with the tool result in history, so the following run continued the conversation without posting again.
Terms in this piece · Glossary
  • AI agent — An AI system that doesn't just answer once but works toward a goal in a loop — taking actions, reading the results, and deciding what to do next.
Read the source openrouter.ai
More from OpenRouter editorial sitemap
Recommended reads
Comments

Checking sign-in…

Loading comments…