Skip to main content
Tools extend the agent’s capabilities, enabling it to interact with external systems, execute code, and perform specialized tasks.

Tool Architecture

DeerFlow’s tools come from multiple sources:

Tool Loading

Tools are assembled via get_available_tools():
Tool Sources (in order):
  1. Config-defined tools (via reflection)
  2. MCP tools (from enabled servers)
  3. Built-in tools
  4. Sub-agent tool (if enabled)

Sandbox Tools

Core filesystem and command execution tools:

bash

Execute shell commands in the sandbox

ls

List directory contents in tree format

read_file

Read file contents with optional line range

write_file

Write or append to files

str_replace

Replace text in files

Sandbox Tools Reference

Complete tool documentation

Built-in Tools

Tools available to all agents:

present_files

Make output files visible to the user. Usage:
Validation:
  • Only files in /mnt/user-data/outputs can be presented
  • Files must exist
  • Returns artifact metadata for frontend display

ask_clarification

Request clarification from the user (interrupts execution). Usage:
Behavior:
  • Interrupts agent execution
  • Returns control to user
  • User response appended to conversation

view_image

Load image as base64 for vision-enabled models. Usage:
Requirements:
  • Model must have supports_vision: true
  • Image formats: PNG, JPEG, GIF, WebP

Built-in Tools Reference

Detailed tool documentation

Community Tools

Pre-integrated external service tools:

web_search (Tavily)

Search the web for current information. Configuration:
Usage:
Requires: TAVILY_API_KEY environment variable

web_fetch

Fetch and extract content from web pages. Providers: Tavily, Jina AI, Firecrawl Configuration:
Usage:

image_search (DuckDuckGo)

Search for images. Configuration:
Usage:

Community Tools Reference

All community tools

MCP Tools

Model Context Protocol (MCP) enables integration with external tools and services. Configuration (extensions_config.json):
Features:
  • stdio transport: Command-based servers
  • HTTP/SSE transport: Web-based servers
  • OAuth support: Automatic token management
  • Lazy loading: Tools loaded on first use
  • Cache invalidation: Detects config changes

MCP Integration Guide

Set up MCP servers

Sub-agent Tool

Delegate complex tasks to sub-agents. Configuration:
Usage:
Features:
  • Up to 3 concurrent sub-agents
  • Isolated contexts
  • Shared filesystem
  • 15-minute timeout

Sub-agents

Learn about task delegation

Custom Tools

Add your own tools via config.yaml:
Tool Function:
my_tools/custom.py
Reflection System:
  • use: module.path:variable_name resolved via resolve_variable()
  • Validates against LangChain tool interface
  • Supports any callable that returns a LangChain tool

Creating Custom Tools

Build your own tools

Tool Groups

Organize tools into logical groups:
Usage:

Tool Calling Flow

  1. Agent Decision: Agent decides to use a tool
  2. Tool Call Message: AIMessage with tool_calls
  3. Tool Execution: Tool function invoked
  4. Tool Message: ToolMessage with result
  5. Agent Processing: Agent processes result
Example:

Error Handling

Tools should handle errors gracefully:
Best Practices:
  • Return error messages as strings (not raise exceptions)
  • Include context in error messages
  • Suggest fixes when possible

Tool Permissions

Skills can restrict tool usage:
SKILL.md frontmatter
When this skill is loaded, only the specified tools are available.

Next Steps

Sandbox Tools

Filesystem and command tools

Built-in Tools

Core agent tools

MCP Integration

Connect external tools

Custom Tools

Create your own tools