Skip to main content

Prebuilt agents and tools

AgentFlow includes prebuilt building blocks for common agent patterns. Use them when the default shape matches your workflow, and drop down to StateGraph, Agent, and ToolNode when you need custom control.

Prebuilt agents

Stable prebuilt agents are exported from agentflow.prebuilt.agent and agentflow.prebuilt.

AgentUse case
ReactAgentStandard model and tool loop.
RouterAgentRoute work to specialized agents or branches.
RAGAgentRetrieval-augmented generation with retriever and synthesis steps.

Some experimental modules may exist in source. Treat exported names as the stable public surface.

Prebuilt tools

Common tools are exported from agentflow.prebuilt.tools.

ToolUse case
safe_calculatorEvaluate simple math expressions safely.
fetch_urlFetch web content from a URL.
file_read, file_write, file_searchWork with files where enabled.
google_web_search, vertex_ai_searchSearch integrations.
memory_tool, make_user_memory_tool, make_agent_memory_toolStore or retrieve long-term memory.
create_handoff_tool, is_handoff_toolTransfer control between graph agents.

Handoff tools

Handoff tools let the model transfer execution to another graph node by calling a tool with the transfer_to_<agent> convention.

from agentflow.prebuilt.tools import create_handoff_tool
from agentflow.core import ToolNode

tools = ToolNode([
create_handoff_tool(
agent_name="RESEARCHER",
description="Transfer to the research agent.",
),
])

Use handoff tools for agent-to-agent delegation. Use Command(goto=...) when routing should be explicit code rather than an LLM tool choice.

Rules

RuleWhy it matters
Prefer prebuilt agents for common patternsThey encode the standard AgentFlow graph shape.
Keep handoff targets aligned with node namesThe graph jumps to the target node.
Use tools for capabilities, not routing policyRouting policy often belongs in graph edges or Command.
Check reference docs for constructor detailsPrebuilt surfaces evolve as new patterns stabilize.