pub struct BlockConfigBuilder { /* private fields */ }Expand description
Chainable builder for BlockConfig, created via
BlockConfig::builder.
Each setter returns self for fluent chaining. Setters for Option<_>
fields take the inner value and wrap it in Some internally, so callers
pass e.g. .prompt(PromptSource::Inline(..)) rather than an Option.
Fields left untouched keep the defaults documented on the corresponding
BlockConfig field.
Because BlockConfig is #[non_exhaustive], this builder is the only
supported way for crates outside agent-block-core to construct one, and
it stays source-compatible as new config fields are introduced.
Implementations§
Source§impl BlockConfigBuilder
impl BlockConfigBuilder
Sourcepub fn script(self, script: ScriptSource) -> Self
pub fn script(self, script: ScriptSource) -> Self
Override the Lua script to execute (BlockConfig::script).
Sourcepub fn project_root(self, project_root: impl Into<PathBuf>) -> Self
pub fn project_root(self, project_root: impl Into<PathBuf>) -> Self
Override the project root (BlockConfig::project_root).
Sourcepub fn relay_url(self, relay_url: impl Into<String>) -> Self
pub fn relay_url(self, relay_url: impl Into<String>) -> Self
Set the mesh relay URL (BlockConfig::relay_url). Defaults to None
(mesh disabled).
Sourcepub fn secret_key(self, secret_key: SecretKeySource) -> Self
pub fn secret_key(self, secret_key: SecretKeySource) -> Self
Set the mesh identity secret key source (BlockConfig::secret_key).
Defaults to None (random keypair).
Sourcepub fn mcp_rpc_timeout(self, mcp_rpc_timeout: Duration) -> Self
pub fn mcp_rpc_timeout(self, mcp_rpc_timeout: Duration) -> Self
Override the per-RPC MCP timeout (BlockConfig::mcp_rpc_timeout).
Defaults to agent_block_mcp::DEFAULT_RPC_TIMEOUT.
Sourcepub fn prompt(self, prompt: PromptSource) -> Self
pub fn prompt(self, prompt: PromptSource) -> Self
Set the prompt payload injected as _PROMPT (BlockConfig::prompt).
Defaults to None.
Sourcepub fn context(self, context: PromptSource) -> Self
pub fn context(self, context: PromptSource) -> Self
Set the context payload injected as _CONTEXT
(BlockConfig::context). Defaults to None.
Sourcepub fn host_handlers(
self,
host_handlers: HashMap<String, Arc<dyn Handler>>,
) -> Self
pub fn host_handlers( self, host_handlers: HashMap<String, Arc<dyn Handler>>, ) -> Self
Set the kind-keyed host-side handlers (BlockConfig::host_handlers).
Defaults to an empty map.
Sourcepub fn host_handler(self, host_handler: Arc<dyn Handler>) -> Self
pub fn host_handler(self, host_handler: Arc<dyn Handler>) -> Self
Set the kind-agnostic fallback host handler
(BlockConfig::host_handler). Defaults to None.
Sourcepub fn host_tools(self, host_tools: Vec<HostToolSpec>) -> Self
pub fn host_tools(self, host_tools: Vec<HostToolSpec>) -> Self
Set the Rust-implemented tools injected into the Lua registry
(BlockConfig::host_tools). Defaults to an empty list.
Sourcepub fn http_client(self, http_client: Client) -> Self
pub fn http_client(self, http_client: Client) -> Self
Set a custom reqwest::Client for the http.* bridge
(BlockConfig::http_client). Defaults to None.
Sourcepub fn sql_path(self, sql_path: impl Into<PathBuf>) -> Self
pub fn sql_path(self, sql_path: impl Into<PathBuf>) -> Self
Override the std.sql database path (BlockConfig::sql_path).
Defaults to None.
Sourcepub fn kv_path(self, kv_path: impl Into<PathBuf>) -> Self
pub fn kv_path(self, kv_path: impl Into<PathBuf>) -> Self
Override the std.kv database path (BlockConfig::kv_path).
Defaults to None.
Sourcepub fn ts_path(self, ts_path: impl Into<PathBuf>) -> Self
pub fn ts_path(self, ts_path: impl Into<PathBuf>) -> Self
Override the std.ts database path (BlockConfig::ts_path).
Defaults to None.
Sourcepub fn extra_globals(self, extra_globals: HashMap<String, Value>) -> Self
pub fn extra_globals(self, extra_globals: HashMap<String, Value>) -> Self
Set the extra Lua globals injected before the script runs
(BlockConfig::extra_globals). Defaults to an empty map.
Sourcepub fn auto_serve_bus(self, auto_serve_bus: bool) -> Self
pub fn auto_serve_bus(self, auto_serve_bus: bool) -> Self
Enable or disable the background EventBus dispatcher
(BlockConfig::auto_serve_bus). Defaults to false.
Sourcepub fn shutdown_token(self, shutdown_token: CancellationToken) -> Self
pub fn shutdown_token(self, shutdown_token: CancellationToken) -> Self
Set the caller-supplied cancellation token
(BlockConfig::shutdown_token). Defaults to None.
Sourcepub fn build(self) -> BlockConfig
pub fn build(self) -> BlockConfig
Finalize the builder into a BlockConfig.
Auto Trait Implementations§
impl !RefUnwindSafe for BlockConfigBuilder
impl !UnwindSafe for BlockConfigBuilder
impl Freeze for BlockConfigBuilder
impl Send for BlockConfigBuilder
impl Sync for BlockConfigBuilder
impl Unpin for BlockConfigBuilder
impl UnsafeUnpin for BlockConfigBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more