Expand description
Embeddable wasmtime host for ACT components.
This is the engine behind the act CLI, packaged so other hosts — a
toolserver, a gateway, anything that has to run a component the same way —
get identical capability decisions, credential namespacing, consent
routing and audit records rather than a second implementation of them.
The crate is headless: it knows nothing about terminals, MCP, HTTP or
configuration files. A host supplies the decisions (RuntimeConfig) and
the channel it reaches a human on (ConsentConfig); the runtime supplies
everything downstream of that.
let rt = act_runtime::ComponentRuntime::new()?;
let component = "ghcr.io/actpkg/sqlite:0.1.0".parse()?;
// Ask-mode grants with a denying prompter: the headless default, and the
// reason a capability the operator did not grant stays denied rather than
// silently allowed when no one is there to ask.
let running = rt
.load(
&component,
&act_runtime::RuntimeConfig::default(),
act_runtime::ConsentConfig::deny(),
)
.await?;
let tools = running.handle().list_tools(&Default::default()).await?;
let result = running
.handle()
.call_tool("query", Vec::new(), Vec::new(), None)
.await?;Modules§
- act
- audit
- Structured audit trail for the ACT host.
- consent
- Consent: the question a capability gate asks a human, and the channel it travels on.
- credentials
- Host side of
act:credentials/store. - exports
- fs_
policy - Layer 1 phase C1, part 2/2: custom
wasi:filesystemhost impl that gatesopen_at(and path-taking siblings) on theFsMatcher. - http_
client - Reqwest-backed client for
wasi:http/outgoing-handler. One instance perHostState(per component invocation). Client config — redirect policy, DNS resolver — is baked in at construction from the component’sHttpConfigso we don’t need to thread context through each call. - http_
policy - Layer 1 phase C2: per-request HTTP policy hook.
- resolve
- Component reference resolution, backed by the shared
act-store. - sessions
- Host-side typed handles for the generated
act:sessions/session-providerbindings. - validate
- JSON Schema validation of what an agent sends, before it reaches a
component (
ACT-SPEC.md§6.4,ACT-SESSIONS.md§2.1).
Structs§
- ActWorld
- Auto-generated bindings for an instance a component which
implements the world
act-world. - ActWorld
Indices - Auto-generated bindings for index of the exports of
act-world. - ActWorld
Pre - Auto-generated bindings for a pre-instantiated version of a
component which implements the world
act-world. - Audit
Context - Identity of the running artifact, carried into every audit record.
- Audit
Options - Call
Tool Result - Collected result from call-tool (stream already consumed).
- Component
Handle - Handle to send requests to the component actor.
- Component
Info - Component metadata stored in the
act:componentWASM custom section (CBOR-encoded). - Component
Runtime - Owns the wasmtime
Engine, which is reusable across components: oneComponentRuntimeper host process, manyRunningComponents. - Consent
Config - How an
ask-mode capability gate reaches a human, and where its answers are remembered for the rest of the run. - Credentials
Source - Which credential backend serves this run.
- Host
State - Host state passed into the wasmtime store.
- Metadata
- Key → value metadata, stored as JSON values internally.
- Running
Component - A loaded, instantiated component with its actor running.
- Runtime
Config - What the host decided before the component runs.
- Tool
Provider - The generated tool-provider guest — the always-present surface of every ACT component.
Enums§
- Component
Error - Errors from component calls.
- Component
Ref
Functions§
- create_
engine - Create a wasmtime engine with component-model and async enabled.
- create_
linker - Create a linker with WASI bindings (both P2 and P3).
- create_
store - Create a new store with WASI context, preopening directories from resolved mounts.
- instantiate_
component - Instantiate the component. Returns the tool-provider guest, an optional
SessionProvider(present iff the component exportsact:sessions/session-provider), and the store. - load_
component - Load a .wasm component from a file path and report the SHA-256 of its bytes.
- read_
component_ info - Read component info from the
act:componentcustom section (CBOR-encoded) and standard WASM metadata sections (version,description) as fallback. - spawn_
component_ actor - Spawn the component actor task. Owns the Store, the tool-provider guest,
and the optional
SessionProvider(present iff the component supportsact:sessions/session-provider).