Skip to main content

Orchestration API

Execute multiple tool calls in a single request with automatic concurrency optimization. Read-only tools run in parallel while mutating tools serialize, reducing total execution time without sacrificing safety.
All orchestration endpoints require bearer token authentication. The authenticate middleware is applied when the router is mounted, so every request must include a valid Authorization: Bearer <token> header. Requests are also subject to the general API rate limit of 120 requests per minute.

Execute batch

Submit a batch of tool calls for concurrent execution. The system automatically classifies each tool as read-only or mutating, partitions them into execution batches, and runs them with optimal concurrency.

Request body

In this example, t1 and t2 are read-only and run in parallel. t3 is mutating and runs alone. t4 is read-only and runs after t3 completes.

Response

Errors

Each tool object in the array must include both id and toolName. The API validates these fields and returns a 400 error if any tool object is missing either field.

Tool output structure

Each tool result’s output field contains a ToolExecutionResult object with the following fields:

Safety limits

The tool executor enforces these limits during batch execution:

Serial failure behavior

When a mutating tool fails during serial execution, the batch stops immediately. Remaining tools in that serial batch are not executed. Parallel batches that already completed are unaffected.

Partition (dry run)

Preview how tool calls would be partitioned without executing them. Use this to debug batch composition or estimate parallelization gains.

Request body

Response

Errors

Unlike the batch endpoint, the partition endpoint does not reject empty arrays or enforce a maximum tool limit. An empty tools array returns an empty batches array.

Tool classification

Each tool is classified as readonly (parallelizable) or mutating (must serialize). Unknown tools default to mutating as a safety measure.

Read-only tools

These tools have no side effects and can safely run in parallel:

Mutating tools

These tools modify state and must run one at a time:

Shell command introspection

For bash, exec, and shell tools, the classifier inspects the command input to determine the actual concurrency class. Read-only shell commands are promoted to readonly: Shell commands not in this list are classified as mutating.

Partitioning rules

The partitioner groups tool calls into execution batches using these rules:
  1. Consecutive read-only tools become a single parallel batch
  2. Each mutating tool gets its own serial batch
  3. Two adjacent mutating tools are placed in separate serial batches (they do not merge)

Example

Given tools: [read, grep, bash("cat file"), write, read, bash("git push")] The partitioner produces: The bash("cat file") command is promoted to readonly via shell command introspection, so it joins the first parallel batch. The read at position 5 starts a new parallel batch because the preceding write forced a serial boundary.