Skip to main content

Module runner

Module runner 

Source
Expand description

AgentRunner: the hook-aware driver that turns a sans-IO AgentRun into a complete agent loop.

AgentRun decides what to do next; it performs no IO and carries no hooks. AgentRunner pairs that machine with the side-effecting concerns — building and sending completion requests, executing tools, loading/saving conversation memory — and fires an AgentHook at every observable point. Both the blocking PromptRequest and the StreamingPromptRequest APIs are thin wrappers over an AgentRunner, and you can build one directly to drive an agent with custom, composable hooks:

let response = agent
    .runner("What is 2 + 2?")
    .max_turns(3)
    .run()
    .await?;
println!("{}", response.output);

Structs§

AgentRunner
A hook-aware driver over AgentRun.