Skip to main content

Crate act_runtime

Crate act_runtime 

Source
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:filesystem host impl that gates open_at (and path-taking siblings) on the FsMatcher.
http_client
Reqwest-backed client for wasi:http/outgoing-handler. One instance per HostState (per component invocation). Client config — redirect policy, DNS resolver — is baked in at construction from the component’s HttpConfig so 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-provider bindings.
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.
ActWorldIndices
Auto-generated bindings for index of the exports of act-world.
ActWorldPre
Auto-generated bindings for a pre-instantiated version of a component which implements the world act-world.
AuditContext
Identity of the running artifact, carried into every audit record.
AuditOptions
CallToolResult
Collected result from call-tool (stream already consumed).
ComponentHandle
Handle to send requests to the component actor.
ComponentInfo
Component metadata stored in the act:component WASM custom section (CBOR-encoded).
ComponentRuntime
Owns the wasmtime Engine, which is reusable across components: one ComponentRuntime per host process, many RunningComponents.
ConsentConfig
How an ask-mode capability gate reaches a human, and where its answers are remembered for the rest of the run.
CredentialsSource
Which credential backend serves this run.
HostState
Host state passed into the wasmtime store.
Metadata
Key → value metadata, stored as JSON values internally.
RunningComponent
A loaded, instantiated component with its actor running.
RuntimeConfig
What the host decided before the component runs.
ToolProvider
The generated tool-provider guest — the always-present surface of every ACT component.

Enums§

ComponentError
Errors from component calls.
ComponentRef

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 exports act: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:component custom 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 supports act:sessions/session-provider).