Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
Core Concepts
Reasoning
Memory & Retrieval
Agent Types
Design Patterns
Training & Alignment
Frameworks
Tools
Safety & Security
Evaluation
Meta
XAgent is an open-source autonomous agent developed by OpenBMB at Tsinghua University, with over 8,500 GitHub stars. Designed to solve complex, multi-step tasks without human intervention, XAgent uses a hierarchical planning architecture with three core components – Dispatcher, Planner, and Actor – that decompose high-level goals into executable subtasks. All tool execution runs safely inside Docker containers via the ToolServer system.
XAgent represents a research-driven approach to autonomous agents, emphasizing safety through sandboxed execution, extensibility through modular tool integration, and human-agent collaboration when needed. It supports a wide range of built-in tools including file editing, Python notebooks, web browsing, and shell access.
XAgent's core architecture consists of three interconnected components that work together in a hierarchical planning loop:
The system operates through a dual-loop mechanism:
ToolServer is a Docker-based infrastructure providing safe, sandboxed tool execution:
Built-in tools include:
# XAgent configuration and task execution # 1. Clone and set up the environment # git clone https://github.com/OpenBMB/XAgent.git # cd XAgent && pip install -r requirements.txt # 2. Start ToolServer (Docker required) # docker compose up -d toolserver # 3. Configure and run XAgent from XAgent.core import XAgentCore from XAgent.config import XAgentConfig config = XAgentConfig( model="gpt-4", api_key="your-openai-key", toolserver_url="http://localhost:8080", max_chain_length=10, enable_human_feedback=False, ) # Initialize XAgent with the Dispatcher-Planner-Actor architecture agent = XAgentCore(config=config) # Submit a complex task -- XAgent decomposes it automatically task = "Analyze the CSV file sales_data.csv, generate summary statistics, " \ "create visualizations for trends, and write a report in markdown." # The Dispatcher routes to Planner, which creates subtasks: # 1. Read and parse the CSV file (Actor + File Editor) # 2. Compute statistics (Actor + Python Notebook) # 3. Generate charts (Actor + Python Notebook) # 4. Write markdown report (Actor + File Editor) result = agent.run(task) # Access results and execution trace print(result.summary) print(result.artifacts) # Generated files: charts, report, etc.
%%{init: {"theme": "base", "themeVariables": {"primaryColor": "#8E44AD"}}}%%
graph TD
A[User Task] --> B[Dispatcher]
B --> C[Planner]
C --> D[Task Decomposition]
D --> E[Subtask 1]
D --> F[Subtask 2]
D --> G[Subtask N]
E --> H[Actor]
F --> H
G --> H
H --> I{Tool Needed?}
I -->|Yes| J[ToolServer]
J --> K[File Editor]
J --> L[Python Notebook]
J --> M[Web Browser]
J --> N[Shell]
I -->|No| O[LLM Reasoning]
K --> P[Result]
L --> P
M --> P
N --> P
O --> P
P --> Q{Subtask Complete?}
Q -->|No| H
Q -->|Yes| R{All Subtasks Done?}
R -->|No| C
R -->|Yes| S[Final Result]