Some primitives for building long-horizon agents: https://t.co/LMOT3loMF8 https://t.co/TU4ijNzEdI
OpenRouter Adds Long Horizon Primitives to Build Durable Multi Hour Agents
OpenRouter, a unified gateway for LLMs, introduced "long-horizon" primitives to its Agent SDK. These tools are designed for agentic AI (systems that autonomously plan and execute multi-step actions) that needs to operate over hours. The update formalizes a framework for managing durable, multi-turn loops.
- Availability
- @openrouter/agent TypeScript SDK
- Cost controls
- maxCost and stepCountIs ceilings
- State management
- Resumable state with StateAccessor
- Voice support
- Speech-to-text and text-to-speech
- Monitoring
- Real-time streaming of tool calls and events
Building reliable agents is difficult because long-running loops are prone to network failures and runaway costs. This release addresses those risks by providing built-in cost and step ceilings alongside automatic retries with backoff. It builds on OpenRouter's human-in-the-loop tools to ensure high-stakes decisions remain under human control.
You can now implement resumable state to persist conversation history, allowing agents to continue after a crash or manual pause. The SDK also includes new voice endpoints for driving loops via speech and a self-ask pattern to reduce hallucinations. These features are available now through the @openrouter/agent TypeScript library.
OpenRouter
@OpenRouter
1retweets20likes
View on XStill wondering? A few quick answers below.
Long-horizon agents are autonomous AI systems designed to perform complex, multi-step tasks that run for hours rather than seconds. OpenRouter provides a specialized Agent SDK with primitives that handle the orchestration, state management, and safety guardrails required to keep these long-running loops stable and cost-effective in production environments.
The SDK allows developers to set explicit stop conditions for autonomous agent loops using cost and step ceilings. By implementing guards like maxCost and stepCountIs, you can ensure that an agent ends its task gracefully once it reaches a specific budget or iteration limit, preventing runaway spending during multi-hour operations.
Yes, the Agent SDK supports resumable state through a StateAccessor. This feature persists conversation messages, tool results, and shared context, allowing you to pause an agent for human review or restart it after a crash or deployment. The agent can then continue its work exactly where it left off without losing progress.
OpenRouter provides dedicated audio endpoints for transcriptions and speech that can drive the same agent loops used for text. You can send audio from a phone call or live microphone to be transcribed, run the agent loop with tools and stop conditions, and then pipe the text result back into a spoken response.
This is an adversarial loop where the agent is wrapped in a self-review process that runs until it emits a specific completion signal. This primitive helps catch gaps, hallucinations, or unverified claims by forcing the model to critique its own work before finalizing a report or taking a high-stakes action.


