Skip to content

WIT Tool Authoring

Every tool in RunVero implements the centralized WebAssembly Interface Type (WIT) contract defined in wit/agent-tool.wit.

package runvero:agent;
interface execution {
record tool-request {
tool-name: string,
params-json: string,
context-id: string,
}
record tool-response {
success: bool,
output-json: string,
error: option<string>,
fuel-consumed: u64,
}
execute: func(req: tool-request) -> tool-response;
}
world agent-tool {
export execution;
}
  1. Create a library targeting wasm32-wasip2 using cargo-component:

    Terminal window
    cargo component new --lib my-tool
  2. Implement the generated WIT bindings:

    use bindings::exports::runvero::agent::execution::{Guest, ToolRequest, ToolResponse};
    struct MyTool;
    impl Guest for MyTool {
    fn execute(req: ToolRequest) -> ToolResponse {
    ToolResponse {
    success: true,
    output_json: format!("Processed {}", req.params_json),
    error: None,
    fuel_consumed: 0,
    }
    }
    }
  3. Build to wasm32-wasip2:

    Terminal window
    cargo component build --release --target wasm32-wasip2

Using componentize-py, you can compile Python scripts into standalone WASI 0.2 components without needing an external Python runtime on the host!