Skip to main content

BlockConfigBuilder

Struct BlockConfigBuilder 

Source
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

Source

pub fn script(self, script: ScriptSource) -> Self

Override the Lua script to execute (BlockConfig::script).

Source

pub fn project_root(self, project_root: impl Into<PathBuf>) -> Self

Override the project root (BlockConfig::project_root).

Source

pub fn relay_url(self, relay_url: impl Into<String>) -> Self

Set the mesh relay URL (BlockConfig::relay_url). Defaults to None (mesh disabled).

Source

pub fn secret_key(self, secret_key: SecretKeySource) -> Self

Set the mesh identity secret key source (BlockConfig::secret_key). Defaults to None (random keypair).

Source

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.

Source

pub fn prompt(self, prompt: PromptSource) -> Self

Set the prompt payload injected as _PROMPT (BlockConfig::prompt). Defaults to None.

Source

pub fn context(self, context: PromptSource) -> Self

Set the context payload injected as _CONTEXT (BlockConfig::context). Defaults to None.

Source

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.

Source

pub fn host_handler(self, host_handler: Arc<dyn Handler>) -> Self

Set the kind-agnostic fallback host handler (BlockConfig::host_handler). Defaults to None.

Source

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.

Source

pub fn http_client(self, http_client: Client) -> Self

Set a custom reqwest::Client for the http.* bridge (BlockConfig::http_client). Defaults to None.

Source

pub fn sql_path(self, sql_path: impl Into<PathBuf>) -> Self

Override the std.sql database path (BlockConfig::sql_path). Defaults to None.

Source

pub fn kv_path(self, kv_path: impl Into<PathBuf>) -> Self

Override the std.kv database path (BlockConfig::kv_path). Defaults to None.

Source

pub fn ts_path(self, ts_path: impl Into<PathBuf>) -> Self

Override the std.ts database path (BlockConfig::ts_path). Defaults to None.

Source

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.

Source

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.

Source

pub fn shutdown_token(self, shutdown_token: CancellationToken) -> Self

Set the caller-supplied cancellation token (BlockConfig::shutdown_token). Defaults to None.

Source

pub fn build(self) -> BlockConfig

Finalize the builder into a BlockConfig.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeSend for T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more