pub struct AgentBuilder { /* private fields */ }Expand description
Re-export of the public orchestration API.
This is the primary entry point for most users.
Builds an Agent.
An Agent is lightweight configuration — no infrastructure, no session.
All runtime concerns are injected at call time via &AgentRuntime or
&mut AgentRuntime.
§Example
let agent = Agent::builder()
.system_prompt("You are a helpful assistant.")
.on_token(|t| print!("{t}"))
.build();Implementations§
Source§impl AgentBuilder
impl AgentBuilder
pub fn new() -> AgentBuilder
Sourcepub fn system_prompt(self, prompt: impl Into<String>) -> AgentBuilder
pub fn system_prompt(self, prompt: impl Into<String>) -> AgentBuilder
A system-level prompt that prefixes every interaction.
Sourcepub fn on_token<F>(self, f: F) -> AgentBuilder
pub fn on_token<F>(self, f: F) -> AgentBuilder
Fired for each text token streamed from the LLM.
Sourcepub fn on_tool_call<F>(self, f: F) -> AgentBuilder
pub fn on_tool_call<F>(self, f: F) -> AgentBuilder
Fired when a tool call is detected (before execution).
Sourcepub fn on_tool_result<F>(self, f: F) -> AgentBuilder
pub fn on_tool_result<F>(self, f: F) -> AgentBuilder
Fired when a tool execution completes.
Sourcepub fn on_turn_start<F>(self, f: F) -> AgentBuilder
pub fn on_turn_start<F>(self, f: F) -> AgentBuilder
Fired at the start of each ReAct turn.
Sourcepub fn on_turn_end<F>(self, f: F) -> AgentBuilder
pub fn on_turn_end<F>(self, f: F) -> AgentBuilder
Fired at the end of each ReAct turn.
Sourcepub fn on_event<F>(self, f: F) -> AgentBuilder
pub fn on_event<F>(self, f: F) -> AgentBuilder
Fired for every AgentEvent (catch-all).
Trait Implementations§
Source§impl Default for AgentBuilder
impl Default for AgentBuilder
Source§fn default() -> AgentBuilder
fn default() -> AgentBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for AgentBuilder
impl !UnwindSafe for AgentBuilder
impl Freeze for AgentBuilder
impl Send for AgentBuilder
impl Sync for AgentBuilder
impl Unpin for AgentBuilder
impl UnsafeUnpin for AgentBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more