Skip to main content
Qwen-Agent provides a comprehensive set of built-in tools that agents can use to perform various tasks. These tools are registered in the TOOL_REGISTRY and can be easily integrated into your agents.

Available Tools

Code Execution

Code Interpreter

Execute Python code in a sandboxed Docker environment with support for data analysis and visualization.

Python Executor

Direct Python code execution without Docker isolation (use with caution).

Document Processing

Doc Parser

Parse and extract content from various document formats with chunking support.

Simple Doc Parser

Basic document parsing without chunking - extracts raw content from files.

Retrieval (RAG)

Retrieve relevant content from documents using RAG techniques with multiple search strategies.

Web Search

Search the internet using Serper API integration.

Web Extractor

Extract and parse content from web pages.

Image Search

Search for images on the internet.

Image Processing

Image Generation

Generate images from text descriptions using LLM-based image generation.

Image Zoom (Qwen3VL)

Zoom into specific regions of images using Qwen3VL capabilities.

Search Tools

Vector Search

Semantic search using vector embeddings.

Keyword Search

BM25-based keyword search for document retrieval.

Hybrid Search

Combined vector and keyword search for improved retrieval.

Front Page Search

Search based on document front matter and metadata.

Storage & Utilities

Storage

Persistent key-value storage for caching and data management.

MCP Manager

Model Context Protocol integration for external tool connectivity.

Extract Doc Vocabulary

Extract vocabulary and key terms from documents.

Amap Weather

Get weather information using Amap API (Chinese service).

Tool Registry

All tools are registered in the TOOL_REGISTRY dictionary, which maps tool names to their implementation classes:
from qwen_agent.tools import TOOL_REGISTRY

# List all available tools
print(TOOL_REGISTRY.keys())

# Get a specific tool class
CodeInterpreterClass = TOOL_REGISTRY['code_interpreter']

Using Tools with Agents

Tools can be integrated into agents by specifying their names in the function_list parameter:
from qwen_agent.agents import Assistant

bot = Assistant(
    llm={'model': 'qwen-max'},
    function_list=['code_interpreter', 'retrieval', 'web_search']
)

messages = [{'role': 'user', 'content': 'Analyze this data and search for related information'}]
for response in bot.run(messages=messages):
    print(response)

Creating Custom Tools

You can create custom tools by extending the BaseTool class and registering them:
from qwen_agent.tools.base import BaseTool, register_tool
import json5

@register_tool('my_custom_tool')
class MyCustomTool(BaseTool):
    description = 'Description of what this tool does'
    parameters = {
        'type': 'object',
        'properties': {
            'param1': {
                'type': 'string',
                'description': 'Description of param1'
            }
        },
        'required': ['param1']
    }
    
    def call(self, params: str, **kwargs) -> str:
        params_dict = json5.loads(params)
        # Implement your tool logic here
        result = f"Processed: {params_dict['param1']}"
        return result

Tool Base Classes

BaseTool

The base class for all tools. Provides:
  • Parameter validation
  • JSON schema support
  • Abstract call() method for implementation

BaseToolWithFileAccess

Extends BaseTool with file handling capabilities:
  • Automatic working directory management
  • Remote file downloading
  • File caching

Next Steps

Code Interpreter

Learn about executing Python code safely

Retrieval

Implement RAG for document Q&A

Doc Parser

Parse and chunk documents

Web Search

Search the web from your agents

Build docs developers (and LLMs) love