Skip to main content
When an LLM decides to call multiple tools, executing them in parallel instead of sequentially can significantly reduce latency.

Use Restate’s parallelization primitives

Agent SDKs natively support parallel tool calls, but this is disabled when integrating with Restate.
Parallel tool calls that use the Restate Context can execute in a different order during replays, breaking Restate’s deterministic execution guarantees.
Instead, you use Restate’s durable execution primitives (RestatePromise.all() in TypeScript, restate.gather() in Python) to parallelize work. There are two patterns for this:
  1. With Agent SDK: use orchestrator tool: Create a single tool that internally fans out multiple steps in parallel using Restate. The agent SDK sees one tool call, but that tool runs work concurrently.
  2. With only Restate: Custom agent loop: Manage the agentic loop yourself with the Restate SDK directly. You control the tool execution step and can run all tool calls in parallel.

With Agent SDK: Use orchestrator tool

⚠️To ensure deterministic replay when using the Vercel AI with Restate, you need to set providerOptions: { openai: { parallelToolCalls: false } } for all your AI SDK Agents.To use parallel tool calls with the Vercel AI SDK, create a tool that runs multiple analyses in parallel. The LLM calls one tool, and that tool fans out work internally using durable execution primitives.Restate makes sure that all parallel tasks are retried and recovered until they succeed. If one step fails, only that step is retried while the successful results are preserved.
parallel-tools-agent.ts
Install Restate and launch it:
Get the example:
Export your OpenAI API key and run the agent:
Register the agents with Restate:
Start a request:
In the UI, you can see the tool steps running in parallel:
Parallel tool execution trace

Only Restate: custom agent loop with parallel tool calls

When you manage the agentic loop yourself with the Restate SDK, you have full control over tool execution. After the LLM returns multiple tool calls, you start all of them concurrently and wait for all to complete before feeding results back to the LLM.
parallel-tools-agent.ts
Install Restate and launch it:
Get the example:
Export your API key:
Register the services with Restate:
Send a request:
The Restate UI shows how multiple tool calls execute concurrently, with all operations completing in parallel: Parallel tool execution - UI