Skip to main content

invoke_many

Function invoke_many 

Source
pub fn invoke_many(calls: &[(&str, Value)]) -> Result<Vec<Value>, String>
Expand description

Invoke several declared platform tools in one host call, dispatched concurrently host-side — guests have no threads, so this is the way to fan out (e.g. one query per service) instead of a serial loop.

Each element passes the same governance as invoke and consumes one slot of the per-invocation tool-call budget. Ok preserves order: one platform envelope ({"success", "output", "error"}) per request — a per-element denial or failure arrives as an envelope with success: false, so a partial batch still returns the successes. Err is batch-level only (capability, grant, budget).

let results = tools::invoke_many(&[
    ("datadog.logs_search", json!({"query": "service:a status:error"})),
    ("datadog.logs_search", json!({"query": "service:b status:error"})),
])?;