Skip to main content

execute

Function execute 

Source
pub async fn execute(
    substrate: &Arc<dyn Substrate>,
    tool: &str,
    params: &Value,
) -> Option<Result<Value, String>>
Expand description

Execute a built-in commodity tool against the runtime’s bound substrate.

The side-effecting file tools (read_file/write_file/edit_file/ list_dir/find_files/grep_files) resolve and act against substrate, so the agent acts within one environment. calculate is pure — it never consults the substrate. Returns None for unknown tools (so the caller can fall through), Some(result) otherwise.

This entrypoint runs with the read-before-edit / staleness guard disabled (no session ledger). It keeps its historic signature and behavior because it is published crates.io API; new callers that want the guard use execute_with_ledger. In particular, its read_file output remains raw file text for existing callers; the guarded agent path returns numbered display text.