Skip to main content

Crate agent_block_core

Crate agent_block_core 

Source
Expand description

agent-block-core — host runtime + Lua stdlib bridge + EventBus.

Depends on agent-block-types (error / obs) and agent-block-mcp (rmcp wrapper). The bin crate agent-block is a thin CLI on top.

§Cargo features

All three are on by default, so the default build (and the agent-block CLI) keeps the full runtime surface. SDK embedders that only need a subset can opt out with default-features = false and re-enable individual axes:

FeatureEnablesPulls in
meshmesh.* Lua bridge, relay connect, Ed25519 mesh identityagent-mesh-core, agent-mesh-sdk
sqlitesql.* / kv.* / ts.* Lua bridges (SQLite-backed)mlua-batteries-sqlite
mcp-httpmcp.connect_http (Streamable HTTP / SSE MCP transport)agent-block-mcp/mcp-http → rmcp HTTP-client transports

The stdio MCP transport (mcp.connect), http.*, tool.*, sh.*, log.*, bus.*, and the embedded StdPkg blocks are always available.

When a feature is off:

  • mesh: the mesh.* bridge is not registered; BlockConfig::relay_url / secret_key are accepted but ignored.
  • sqlite: the sql.* / kv.* / ts.* bridges are not registered; BlockConfig::sql_path / kv_path / ts_path are accepted but ignored (fields retained for API stability). It does not gate SQLite itself: the kernel (knl) keeps every session’s event log in a SQLite table — the log is read with SQL — so rusqlite and rusqlite-isle are ordinary dependencies and a session is a session in every build. They are the same versions mlua-batteries-sqlite builds on (rusqlite 0.37 / libsqlite3-sys 0.35), which is not a coincidence: libsqlite3-sys declares links = "sqlite3", so a build graph may hold exactly one of it, whichever way the feature is set.
  • mcp-http: mcp.connect_http returns an explicit error when called.

§Sandbox

sandbox installs an optional process-wide execution boundary (Landlock + seccomp, Linux only): filesystem writes are confined to an allowlist and io_uring is denied, while reads and executes stay open. It is inherited by sh.exec / mcp.connect children, and must be applied before any async runtime spawns worker threads — see the module docs.

Re-exports§

pub use host::run;
pub use host::run_capture;
pub use host::BlockConfig;
pub use host::BlockConfigBuilder;
pub use host::HostContext;

Modules§

bridge
Lua Stdlib Bridge — injects all *.* global APIs into the Lua VM.
bus
EventBus: serial event dispatcher feeding Lua handlers registered via bus.on(kind, fn) / bus.on_any(fn).
embedded
The modules baked into the binary, as a list a caller outside this crate can read.
host
Host — the thin Rust shell that wires up Lua VM, Mesh, HTTP, and MCP.
knl
knl — the kernel core: the log, the ledger, the session and its scope.
sandbox
Sandbox — a generic, process-wide execution boundary (Linux only).

Enums§

BlockError

Type Aliases§

BlockResult