Agent SDK adds lifecycle hooks and tools that outlive the turn
- Source
- x.com
- Date
Introducing two features to the OpenRouter Agent SDK: lifecycle hooks and async tools! If you aren't familiar, the Agent SDK is our toolkit for building agentic applications with OpenRouter. These two additions allow to build even more robust AI workflows.
Lifecycle hooks let you take specified actions at fixed points in the callModel loop. Block destructive commands, track token usage and cost, redact secrets from prompts, or mutate tool arguments before execution.
Full hook list and more info on how to use them in the docs: https://t.co/f4Ri4NqxGi
Context
OpenRouter's SDK can leave a tool task pending until an outside system supplies the result. Its deferred mode is designed for work such as human review: the application opens the review task, and a later webhook delivers the decision so the conversation can resume, potentially in another process. A separate background mode lets in-process work continue while the conversation proceeds. The announcement and code example show how an agent workflow can accommodate a response that arrives hours later without requiring the original tool call to remain blocked throughout the wait.
- 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.
Checking sign-in…
Loading comments…









