<img src="https://github.com/HKUDS/AnyTool/raw/main/assets/AnyTool_logo.png" width="800px" style="border: none; box-shadow: none;" alt="AnyTool Logo">
Fast, Scalable and Powerful Tool Use** ✨
| ⚡ Fast - Lightning Tool Retrieval | 📈 Self-Evolving Tool Orchestration | ⚡ Universal Tool Automation |
AnyTool is a Universal Tool-Use Layer that transforms how AI agents interact with tools. It solves three fundamental challenges that prevent reliable agent automation: overwhelming tool contexts, unreliable community tools, and limited capability coverage -- delivering the first truly intelligent tool orchestration system for production AI agents.
⚡ Fast - Lightning Tool Retrieval - Smart Context Management: Progressive tool filtering delivers exact tools in milliseconds through multi-stage pipeline, eliminating context pollution while maintaining speed.
📈 Scalable - Self-Evolving Tool Orchestration - Adaptive MCP Tool Selection: Smart caching and selective re-indexing maintain constant performance from 10 to 10,000 tools with optimal resource usage.
🌍 Powerful - Universal Tool Automation - Quality-Aware Selection: Built-in reliability tracking and safety controls deliver production-ready automation through persistent learning and execution safeguards.
One line to get intelligent tool orchestration. Zero-config setup transforms complex multi-tool workflows into a single API call.
from anytool import AnyTool
# One line to get intelligent tool orchestration
async with AnyTool() as tool_layer:
result = await tool_layer.execute(
"Research trending AI coding tools from GitHub and tech news, "
"collect their features and user feedback, analyze adoption patterns, "
"then create a comparison report with insights"
)
# Clone repository
git clone https://github.com/HKUDS/AnyTool.git
cd AnyTool
# Create and activate conda environment (includes ffmpeg for video recording)
conda create -n anytool python=3.12 ffmpeg -c conda-forge -y
conda activate anytool
# Install dependencies
pip install -r requirements.txt
[!NOTE] Create a
.envfile and add your API keys (refer toanytool/.env.example).
AnyTool's Shell and GUI backends support two execution modes. You can configure the mode in anytool/config/config_grounding.json:
{
"shell": { "mode": "local", ... }, // or "server"
"gui": { "mode": "local", ... } // or "server"
}
In local mode, Shell and GUI operations are executed directly in-process via subprocess / asyncio. This is the simplest setup — no local server required. Just use AnyTool as normal, see Quick Integration for usage examples.
[!TIP] Use local mode when you are running AnyTool on the same machine you want to control (your own laptop / desktop). This is the recommended mode for most users.
In server mode, Shell and GUI operations are sent over HTTP to a running local_server Flask service. This is required when:
To use server mode, set "mode": "server" in config_grounding.json, then install platform-specific dependencies and start the server:
[!IMPORTANT] Platform-specific setup required: Different operating systems need different dependencies for desktop control. Please install the required dependencies for your OS before starting the local server:
macOS Setup
# Install macOS-specific dependencies
pip install pyobjc-core pyobjc-framework-cocoa pyobjc-framework-quartz atomacos
Permissions Required: macOS will automatically prompt for permissions when you first run the local server. Grant the following: - Accessibility (for GUI control) - Screen Recording (for screenshots and video capture)
If prompts don't appear, manually grant permissions in System Settings → Privacy & Security.
Linux Setup
# Install Linux-specific dependencies
pip install python-xlib pyatspi numpy
# Install system packages
sudo apt install at-spi2-core python3-tk scrot
[!NOTE] Optional dependencies: - Accessibility:
pyatspi+at-spi2-core- Window management:wmctrl- Cursor in screenshots:libx11-dev+libxfixes-dev
Windows Setup
# Install Windows-specific dependencies
pip install pywinauto pywin32 PyGetWindow
After installing the platform-specific dependencies, start the local server:
python -m anytool.local_server.main
[!NOTE] See
anytool/local_server/README.mdfor complete API documentation and advanced configuration.
Local Mode ("local") |
Server Mode ("server") |
|
|---|---|---|
| Setup | Zero — just run your agent | Start local_server first |
| Use case | Same-machine development | Remote VMs, sandboxing, multi-machine |
| Shell execution | asyncio.subprocess in-process |
HTTP → Flask → subprocess |
| GUI execution | Direct pyautogui / ScreenshotHelper | HTTP → Flask → pyautogui |
| Dependencies | Only core AnyTool | Core + Flask + platform deps |
| Network | None required | HTTP between agent ↔ server |
AnyTool is a plug-and-play Universal Tool-Use Layer for any AI agent. The task passed to execute() can come from your agent's planning module, user input, or any workflow system.
import asyncio
from anytool import AnyTool
from anytool.tool_layer import AnyToolConfig
async def main():
config = AnyToolConfig(
enable_recording=True,
recording_backends=["gui", "shell", "mcp", "web"],
enable_screenshot=True,
enable_video=True,
)
async with AnyTool(config=config) as tool_layer:
result = await tool_layer.execute(
"Research trending AI coding tools from GitHub and tech news, "
"collect their features and user feedback, analyze adoption patterns, "
"then create a comparison report with insights"
)
print(result["response"])
asyncio.run(main())
[!TIP] MCP Server Configuration: For tasks requiring specific tools, add relevant MCP servers to
anytool/config/config_mcp.json. Unsure which servers to add? Simply add all potentially useful ones, AnyTool's Smart Tool RAG will automatically select the appropriate tools for your task. See MCP Configuration for details.
The Problem. Current MCP agents suffer from a fundamental design flaw: they load ALL configured servers and tools at every execution step, creating an overwhelming action space, creates three critical issues: - ⚡ Slow Performance with Massive Context Loading
Complete tool set from all pre-configured servers loaded simultaneously at every step, degrading execution speed
Users cannot preview tools before connecting, leading to over-setup "just in case" and confusing tool selection
Same tools reloaded at every execution step with no caching, causing redundant loading
Motivation: "Load Everything" → "Retrieve What's Needed"
Improvement: Faster tool selection, cleaner context, and efficient resource usage through smart retrieval and memory.
🎯 Multi-Stage Tool Retrieval Pipeline - Progressive MCP Tool Filtering: server selection → tool name matching → tool semantic search → LLM ranking - Reduces MCP Tool Search Space: Each stage narrows down candidate tools for optimizing precision and speed
💾 Long-Term Tool Memory - Save Once, Use Forever: Pre-compute tool embeddings once and save them to disk for instant reuse - Zero Waste Processing: No more redundant processing - tools are ready to use immediately across all execution steps
🧠 Adaptive Tool Selection - Adaptive MCP Tool Ranking: LLM-based tool selection refinement triggered only when MCP tool results are large or ambiguous - Tool Selection Efficiency: Balances MCP tool accuracy with computational efficiency
🚀 On-Demand Resource Management - Lazy MCP Server Startup: MCP server initialization triggered only when specific tools are needed - Selective Tool Updates: Incremental re-indexing of only changed MCP tools, not the entire tool set
The Problem. Current MCP servers suffer from community contribution challenges that create three critical issues: - 🔍 Poor Tool Descriptions
Misleading claims, non-existent advertised tools, and vague capability specifications lead to wrong tool selection.
Cannot assess MCP tool quality before use, causing blind selection decisions.
Unvetted community tools may execute dangerous operations without proper safeguards.
Motivation: "Blind Tool Trust" → "Smart Quality Assessment"
Improvement: Reliable tool selection, safe execution, and autonomous recovery through quality tracking and safety controls.
🎯 Quality-Aware Tool Selection - Description Quality Check: LLM-based evaluation of MCP tool description clarity and completeness. - Performance-Based Ranking: Track call/success rates for each MCP tool in persistent memory to prioritize reliable options.
💾 Learning-Based Tool Memory - Track Tool Performance: Remember which MCP tools work well and which fail over time. - Smart Tool Prioritization: Automatically rank tools based on past success rates and description quality.
🛡️ Safety-First Execution - Block Dangerous Operations: Prevent arbitrary code execution and require user approval for sensitive MCP tool operations. - Execution Safeguards: Built-in safety controls for all MCP tool executions.
🚀 Self-Healing Tool Management - Autonomous Tool Switching: Switch failed MCP tools locally without restarting expensive planning loops. - Local Failure Recovery: Automatically switch to alternative MCP tools on failure without escalating to upper-level agents.
The Problem. Current MCP ecosystem focuses primarily on Web APIs and online services, creating significant automation gaps that prevent comprehensive task completion:
No native support for file manipulation, process management, or command execution on local systems.
Cannot control GUI applications that lack APIs, limiting automation to web-only scenarios.
Limited server categories in community and incomplete tool sets within existing servers create workflow bottlenecks.
(MCP + System Commands + GUI Control ≈ Universal Task Completion)
Motivation: "Web-Only MCP" → "Universal Task Completion"
Improvement: Complete automation coverage through multi-backend architecture that seamlessly extends MCP capabilities beyond web APIs.
🏗️ Multi-Backend Architecture - MCP Backend: Community servers for Web APIs and online services - Shell Backend: Bash/Python execution for system-level operations and file management - GUI Backend: Pixel-level automation for any visual application without API requirements - Web Backend: Deep web research and data extraction capabilities
💡 Self-Evolving Capability Discovery
$ claude mcp add AnyTool \
-- python -m otcore.mcp_server <graph>