Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

WASM Tools

Swarmie defines WASM tool configuration under [wasm_tools.<name>] in TOML (crates/core/src/config/toml_types.rs). Runtime structures are in crates/core/src/config/types.rs and execution limits are in crates/wasm/src/limits.rs.

Config Shape

[wasm_tools.echo]
path = "tools/echo.wasm"
capabilities = ["Logging", "HttpRequest"]
secrets = ["API_TOKEN"]
workspace_prefixes = ["src/", "tests/"]
endpoint_allowlist = ["https://api.example.com/*"]
 
[wasm_tools.echo.tool_aliases]
old_name = "new_name"
 
[wasm_tools.echo.limits]
max_memory_bytes = 67108864
fuel_limit = 1000000000
execution_timeout_secs = 30
max_log_entries = 1000
max_http_requests = 50
max_tool_invocations = 20
max_file_read_bytes = 10485760

Fields

FieldTypeDescription
pathstringPath to .wasm component file.
capabilitiesarray(string)Capability grants exposed to host bindings.
secretsarray(string)Secret names accessible via WASM secret APIs.
workspace_prefixesarray(string)Workspace directory prefixes permitted for file access.
endpoint_allowlistarray(string)Allowed endpoint patterns for outbound HTTP.
tool_aliasestableAlias map (alias -> real tool name) for tool invocation.
limits.*tableResource limit overrides for this tool.

Resource Limits

Default ResourceLimits (crates/wasm/src/limits.rs):

  • max_memory_bytes: 64 MiB
  • fuel_limit: 1_000_000_000
  • execution_timeout_secs: 30
  • max_log_entries: 1000
  • max_http_requests: 50
  • max_tool_invocations: 20
  • max_file_read_bytes: 10 MiB

Hard validation includes:

  • memory must be > 0 and <= 512 MiB
  • timeout must be > 0 and <= 300s
  • all counters must be > 0

Runtime Note

[wasm_tools] is defined in TOML schema and runtime types; the current resolved runtime config path (resolve_from_toml) does not yet project wasm_tools into ResolvedConfig (crates/core/src/config/resolve.rs).