Skip to main content

AgentBuilder

Defined in the Agent Builder module.
Rust AI Agent SDK Builder for creating agents

Fields

NameTypeDescription
nameOption<String>-
instructionsOption<String>-
llm_configLlmConfig-
toolsVec<Box<dyn Tool>>-
memory_configMemoryConfig-
configAgentConfig-

Methods

new

fn new() -> Self
Create a new agent builder

name

fn name(mut self, name: impl Into<String>) -> Self
Set the agent name Parameters:
NameType
nameimpl Into&lt;String&gt;

instructions

fn instructions(mut self, instructions: impl Into<String>) -> Self
Set the system instructions Parameters:
NameType
instructionsimpl Into&lt;String&gt;

model

fn model(mut self, model: impl Into<String>) -> Self
Set the LLM model Parameters:
NameType
modelimpl Into&lt;String&gt;

llm

fn llm(self, model: impl Into<String>) -> Self
Alias for model() - matches Python SDK Parameters:
NameType
modelimpl Into&lt;String&gt;

api_key

fn api_key(mut self, key: impl Into<String>) -> Self
Set the API key Parameters:
NameType
keyimpl Into&lt;String&gt;

base_url

fn base_url(mut self, url: impl Into<String>) -> Self
Set the base URL for the LLM API Parameters:
NameType
urlimpl Into&lt;String&gt;

temperature

fn temperature(mut self, temp: f32) -> Self
Set the temperature Parameters:
NameType
tempf32

max_tokens

fn max_tokens(mut self, max: u32) -> Self
Set max tokens Parameters:
NameType
maxu32

tool

fn tool(mut self, tool: impl Tool + 'static) -> Self
Add a tool Parameters:
NameType
toolimpl Tool + 'static

tools

fn tools(mut self, tools: impl IntoIterator<Item = impl Tool + 'static>) -> Self
Add multiple tools Parameters:
NameType
toolsimpl IntoIterator&lt;Item

memory

fn memory(mut self, enabled: bool) -> Self
Enable memory Parameters:
NameType
enabledbool

memory_config

fn memory_config(mut self, config: MemoryConfig) -> Self
Set memory configuration Parameters:
NameType
configMemoryConfig

max_iterations

fn max_iterations(mut self, max: usize) -> Self
Set max iterations for tool calling Parameters:
NameType
maxusize

verbose

fn verbose(mut self, enabled: bool) -> Self
Enable verbose output Parameters:
NameType
enabledbool

stream

fn stream(mut self, enabled: bool) -> Self
Enable/disable streaming Parameters:
NameType
enabledbool

build

fn build(self) -> Result<Agent>
Build the agent