Expand description
High-level builder API for driving agents programmatically.
Instead of shelling out to the agent CLI binary, Rust programs can
use AgentBuilder to configure and execute agent sessions directly.
§Examples
use zag_agent::builder::AgentBuilder;
// Non-interactive exec — returns structured output
let output = AgentBuilder::new()
.provider("claude")
.model("sonnet")
.auto_approve(true)
.exec("write a hello world program")
.await?;
println!("{}", output.result.unwrap_or_default());
// Interactive session
AgentBuilder::new()
.provider("claude")
.run(Some("initial prompt"))
.await?;Structs§
- Agent
Builder - Builder for configuring and running agent sessions.