Skip to main content
Agent tools come in two flavors: local tools that run inside the agent handler, and workflows exposed as tools that run as separate services. This page focuses on deploying workflows as agent tools. For local tools (wrapping tool logic in ctx.run() within the agent handler), see Durable Agents.

Why expose workflows as tools?

As your agent tools grow more complex, you can extract them into separate Restate services and expose them as tools:
  • Scale independently: Tools can run on different infrastructure, scale separately from the agent
  • Any language: Write tools in a different language than the agent (e.g., Python tool called from TypeScript agent)
  • Long-running and async: Remote workflows can be started asynchronously without blocking the agent execution and can take minutes or hours (human approval, external processing)
All calls between the agent and its tool services are proxied via Restate, which persists the call and handles retries and recovery.

Example: human approval workflow as a tool

This example shows a human approval workflow exposed as an agent tool. The workflow creates an awakeable, sends a review request, and suspends until a human responds. The agent treats this like any other tool call.

1. Define the sub-workflow

Extract the tool logic into a separate Restate service: The sub-workflow uses ctx.awakeable() to create a durable promise that can be resolved externally via HTTP. The agent suspends while waiting, freeing compute resources.

2. Call it from the agent

The agent exposes the sub-workflow as a tool. When the LLM picks it, the agent calls the remote service via Restate’s service client:
Sub-workflow execution trace