act-sdk 0.3.0

Rust SDK for building ACT (Agent Component Tools) WebAssembly components
Documentation

Rust SDK for the ACT protocol — define tools as plain functions, compile to .wasm, serve over MCP or HTTP.

Quick start

use act_sdk::prelude::*;

#[derive(Deserialize, JsonSchema)]
struct GreetArgs {
    name: String,
}

#[act_component(name = "greeter", version = "0.1.0", description = "A greeter")]
mod component {
    use super::*;

    #[act_tool(description = "Say hello", read_only)]
    fn greet(args: GreetArgs) -> ActResult<String> {
        Ok(format!("Hello, {}!", args.name))
    }
}
cargo build --target wasm32-wasip2 --release
act serve target/wasm32-wasip2/release/greeter.wasm
# or
act mcp target/wasm32-wasip2/release/greeter.wasm

Workspace crates

Crate Description
act-sdk SDK with #[act_component] and #[act_tool] macros
act-sdk-macros Proc macro implementation
act-types Shared types, CBOR utilities, JSON-RPC and MCP wire formats

Features

  • #[act_tool] — derive tool metadata, JSON Schema, and CBOR serialization from a plain Rust function
  • Streaming — mark tools with streaming and use ActContext to emit progress events
  • Typed config — define a config struct, get automatic JSON Schema generation and validation
  • MCP + HTTP — same .wasm works with both transports, zero code changes

Examples

Example What it shows
hello-sdk Basic tools, streaming with ctx.send_progress()
config-sdk Typed component configuration
http-client-sdk Outbound HTTP via WASI
hello-world Minimal component without SDK (raw wit-bindgen)
http-client Raw HTTP client without SDK
counter Stateful counter

Building

Requires Rust nightly (for wasm32-wasip2 async support):

# Build all examples
cargo build --target wasm32-wasip2 --release

# Run tests (host-side, not wasm)
cargo test --target x86_64-unknown-linux-gnu

See rust-toolchain.toml for the pinned toolchain.

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.