Dapr Agents allows one DurableAgent to call another agent as a synchronous child workflow tool. When an LLM selects an agent as a tool, the framework schedules the target agent's workflow as a Dapr child workflow. The result of the target agent's execution is returned to the caller as a ToolMessage, integrating seamlessly into the caller's conversation history and durable execution model.
There are three primary ways to configure an agent to act as a tool for another agent:
- Explicit Cross-App Factory: Use
agent_to_tool to wire agents that live in separate Dapr applications. This method does not require a shared registry. - Direct Instance Passing (In-Process): Pass a
DurableAgent instance directly into the tools list of another agent. This is used when both agents run in the same Dapr app/Python process; the framework auto-converts the instance into an AgentWorkflowTool. - Shared Registry (Auto-discovery): If both agents are configured with a
registry, the framework automatically discovers peer agents at the start of a workflow run. The load_tools mechanism scans the registry and registers all peers (excluding orchestrators and self) in the tool_executor.
from dapr_agents.tool.workflow.agent_tool import agent_to_tool
# 1. Explicit cross-app factory (no registry needed)
sam_tool = agent_to_tool(
"sam",
description="Sam Gamgee. Goal: Manage provisions.",
target_app_id="SamApp",
)
frodo = DurableAgent(name="frodo", tools=[sam_tool], ...)
# 2. Pass DurableAgent instance directly (auto-converted, same app)
sam = DurableAgent(name="sam", registry=registry, ...)
frodo = DurableAgent(name="frodo", tools=[sam], ...)
# 3. Shared registry (auto-discovery)
sam = DurableAgent(name="sam", registry=registry, ...)
frodo = DurableAgent(name="frodo", registry=registry, ...)