pub struct AgentRuntimeBuilder { /* private fields */ }Expand description
Builds an AgentRuntime.
let runtime = AgentRuntime::<DeepSeekProvider>::builder()
.api_key(std::env::var("DEEPSEEK_API_KEY")?)
.model("deepseek-v4-flash")
.build()?;Implementations§
Source§impl AgentRuntimeBuilder
impl AgentRuntimeBuilder
pub fn new() -> Self
Sourcepub fn api_key(self, key: impl Into<String>) -> Self
pub fn api_key(self, key: impl Into<String>) -> Self
OpenAI API key. Falls back to OPENAI_API_KEY env var.
Sourcepub fn base_url(self, url: Option<String>) -> Self
pub fn base_url(self, url: Option<String>) -> Self
Custom base URL (proxy, compatible API, etc.).
Pass e.g. std::env::var("OPENAI_BASE_URL").ok().
Sourcepub fn model(self, model: impl Into<String>) -> Self
pub fn model(self, model: impl Into<String>) -> Self
LLM model name. Falls back to OPENAI_MODEL env var, then "gpt-4o".
Sourcepub fn client(self, client: Client<OpenAIConfig>) -> Self
pub fn client(self, client: Client<OpenAIConfig>) -> Self
Directly provide an OpenAI client (overrides api_key + base_url).
Sourcepub fn max_iterations(self, n: usize) -> Self
pub fn max_iterations(self, n: usize) -> Self
Maximum number of ReAct iterations per call (default 10).
Sourcepub fn channel_buffer(self, n: usize) -> Self
pub fn channel_buffer(self, n: usize) -> Self
Internal channel buffer size (default 32).
Sourcepub fn with_tool<T: Tool + Default + 'static>(self) -> Self
pub fn with_tool<T: Tool + Default + 'static>(self) -> Self
Register a tool by its type (requires Tool + Default).
Sourcepub fn with_tool_instance(self, tool: Arc<dyn Tool>) -> Self
pub fn with_tool_instance(self, tool: Arc<dyn Tool>) -> Self
Register a pre-constructed tool.
Sourcepub fn build(self) -> Result<AgentRuntime<DeepSeekProvider>, OrchestrateError>
pub fn build(self) -> Result<AgentRuntime<DeepSeekProvider>, OrchestrateError>
Build the runtime with the default DeepSeek provider.
Sourcepub fn build_with<P: ChatProvider>(
self,
) -> Result<AgentRuntime<P>, OrchestrateError>
pub fn build_with<P: ChatProvider>( self, ) -> Result<AgentRuntime<P>, OrchestrateError>
Build the runtime with a custom LLM provider.
let rt = AgentRuntime::<DeepSeekProvider>::builder().api_key(std::env::var("DEEPSEEK_API_KEY")?).model("deepseek-v4-flash").build_with::<DeepSeekProvider>()?;Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AgentRuntimeBuilder
impl !UnwindSafe for AgentRuntimeBuilder
impl Freeze for AgentRuntimeBuilder
impl Send for AgentRuntimeBuilder
impl Sync for AgentRuntimeBuilder
impl Unpin for AgentRuntimeBuilder
impl UnsafeUnpin for AgentRuntimeBuilder
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