Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
AgentBuilder
Defined in the builder module.
Rust AI Agent SDK
Builder for creating agents
Fields
| Name | Type | Description |
|---|
name | Option<String> | - |
instructions | Option<String> | - |
llm_config | LlmConfig | - |
tools | Vec<Box<dyn Tool>> | - |
memory_config | MemoryConfig | - |
config | AgentConfig | - |
Methods
new
Create a new agent builder
name
fn name(mut self, name: impl Into<String>) -> Self
Set the agent name
Parameters:
| Name | Type |
|---|
name | impl Into<String> |
instructions
fn instructions(mut self, instructions: impl Into<String>) -> Self
Set the system instructions
Parameters:
| Name | Type |
|---|
instructions | impl Into<String> |
model
fn model(mut self, model: impl Into<String>) -> Self
Set the LLM model
Parameters:
| Name | Type |
|---|
model | impl Into<String> |
llm
fn llm(self, model: impl Into<String>) -> Self
Alias for model() - matches Python SDK
Parameters:
| Name | Type |
|---|
model | impl Into<String> |
api_key
fn api_key(mut self, key: impl Into<String>) -> Self
Set the API key
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
base_url
fn base_url(mut self, url: impl Into<String>) -> Self
Set the base URL for the LLM API
Parameters:
| Name | Type |
|---|
url | impl Into<String> |
temperature
fn temperature(mut self, temp: f32) -> Self
Set the temperature
Parameters:
max_tokens
fn max_tokens(mut self, max: u32) -> Self
Set max tokens
Parameters:
fn tool(mut self, tool: impl Tool + 'static) -> Self
Add a tool
Parameters:
| Name | Type |
|---|
tool | impl Tool + 'static |
fn tools(mut self, tools: impl IntoIterator<Item = impl Tool + 'static>) -> Self
Add multiple tools
Parameters:
| Name | Type |
|---|
tools | impl IntoIterator<Item |
memory
fn memory(mut self, enabled: bool) -> Self
Enable memory
Parameters:
memory_config
fn memory_config(mut self, config: MemoryConfig) -> Self
Set memory configuration
Parameters:
| Name | Type |
|---|
config | MemoryConfig |
max_iterations
fn max_iterations(mut self, max: usize) -> Self
Set max iterations for tool calling
Parameters:
verbose
fn verbose(mut self, enabled: bool) -> Self
Enable verbose output
Parameters:
stream
fn stream(mut self, enabled: bool) -> Self
Enable/disable streaming
Parameters:
build
fn build(self) -> Result<Agent>
Build the agent
Usage
let agent = Agent::new()
.name("assistant")
.instructions("You are helpful")
.model("gpt-4o-mini")
.build()?;
Source
View on GitHub
praisonai/src/agent/builder.rs at line 47