pub struct AgentKernelBuilder { /* private fields */ }Expand description
Builder for AgentKernel.
Implementations§
Source§impl AgentKernelBuilder
impl AgentKernelBuilder
Sourcepub fn llm(self, llm: Arc<dyn ChatProvider>) -> Self
pub fn llm(self, llm: Arc<dyn ChatProvider>) -> Self
Set the LLM provider.
Sourcepub fn tools(self, tools: ToolRegistry) -> Self
pub fn tools(self, tools: ToolRegistry) -> Self
Set the tool registry.
Sourcepub fn max_transcript_chars(self, n: usize) -> Self
pub fn max_transcript_chars(self, n: usize) -> Self
Set the maximum transcript characters before trimming.
Sourcepub fn compactor(self, compactor: Compactor) -> Self
pub fn compactor(self, compactor: Compactor) -> Self
Set the compactor for summarising old messages.
Sourcepub fn microcompactor(self, microcompactor: Microcompactor) -> Self
pub fn microcompactor(self, microcompactor: Microcompactor) -> Self
Set the microcompactor for no-LLM proactive pruning of old tool results.
Sourcepub fn hooks(self, hooks: HookRegistry) -> Self
pub fn hooks(self, hooks: HookRegistry) -> Self
Set the hook registry.
Sourcepub fn shutdown_token(self, token: CancellationToken) -> Self
pub fn shutdown_token(self, token: CancellationToken) -> Self
Set the cancellation token for graceful shutdown. When the token
is cancelled, the kernel’s step loop terminates with
FinishReason::Cancelled
at the next step boundary.
Sourcepub fn with_storage(self, backend: Arc<dyn StorageBackend>) -> Self
pub fn with_storage(self, backend: Arc<dyn StorageBackend>) -> Self
Inject a storage backend. If not set, build() defaults to
LocalStorageBackend rooted at the current working directory.
Sourcepub fn with_session_store(self, store: Arc<dyn SessionStore>) -> Self
pub fn with_session_store(self, store: Arc<dyn SessionStore>) -> Self
Inject a session hot-state store. If not set, build() uses
NoopSessionStore (zero cost, no I/O).
Sourcepub fn with_tool_set_provider(self, provider: Arc<dyn ToolSetProvider>) -> Self
pub fn with_tool_set_provider(self, provider: Arc<dyn ToolSetProvider>) -> Self
Inject a tool set provider. When set and tools() is NOT also called,
build() delegates tools construction to provider.build_registry().
If tools() was set explicitly, that registry takes precedence.
Sourcepub fn stuck_window(self, n: usize) -> Self
pub fn stuck_window(self, n: usize) -> Self
Set the stuck-detection sliding window size.
Sourcepub fn stuck_error_rate(self, rate: f64) -> Self
pub fn stuck_error_rate(self, rate: f64) -> Self
Set the stuck-detection error rate threshold.
Sourcepub fn build(self) -> Result<AgentKernel>
pub fn build(self) -> Result<AgentKernel>
Build the AgentKernel, or return an error if required fields are missing.