English • 中文
Tutorial • Demo • Blog • Citation
XAgent is an open-source experimental Large Language Model (LLM) driven autonomous agent that can automatically solve various tasks. It is designed to be a general-purpose agent that can be applied to a wide range of tasks. Currently, XAgent is still in its early stage, and we are working hard to improve it.
🏆 Our goal is to create a super-intelligent agent that can solve any given task!
We welcome diverse forms of collaborations, including full-time, part-time roles, and more. If you are interested in the frontiers of agents and want to join us in realizing true autonomous agents, please contact us at xagentteam@gmail.com.
XAgent is designed with the following features:
- Autonomy: XAgent can automatically solve various tasks without human participation.
- Safety: XAgent is designed to run safely. All actions are constrained inside a docker container. Run it anyway!
- Extensibility: XAgent is designed to be extensible. You can easily add new tools to enhance agent's abilities and even new agents!
- GUI: XAgent provides a friendly GUI for users to interact with the agent. You can also use the command line interface to interact with the agent.
- Cooperation with Human: XAgent can collaborate with you to tackle tasks. It not only has the capability to follow your guidance in solving complex tasks on the go but also can seek your assistance when it encounters challenges.
XAgent is composed of three parts:
- 🤖 Dispatcher is responsible for dynamically instantiating and dispatching tasks to different agents. It allows us to add new agents and improve the agents' abilities.
- 🧐 Planner is responsible for generating and rectifying plans for tasks. It divides a task into subtasks and generates milestones for them, allowing agents to solve tasks step by step.
- 🦾 Actor is responsible for conducting actions to achieve goals and finish subtasks. The actor utilizes various tools to solve subtasks, and it can also collaborate with human to solve tasks.
ToolServer is the server that provides XAgent with powerful and safe tools to solve tasks. It is a docker container that provides a safe environment for XAgent to run. Currently, ToolServer provides the following tools:
- 📝 File Editor provides a text editing tool that can write, read, and modify files.
- 📘 Python Notebook provides an interactive Python notebook that can run Python code to validate ideas, draw figures, etc.
- 🌏 Web Browser provides a web browser that can search and visit webpages.
- 🖥️ Shell provides a bash shell tool that can execute any shell commands, even install programs and host services.
- 🧩 Rapid API provides a tool to retrieve APIs from Rapid API and call them, which provides a wide range of APIs for XAgent to use. See ToolBench to get more information about the Rapid API collections. You can also easily add new tools to ToolServer to enhance XAgent's abilities.
ToolServer is where XAgent's action takes place. It is a docker container that provides a safe environment for XAgent to run.
So you should install docker
and docker-compose
first.
After that, you should build the docker image for ToolServer and start the docker container.
cd ToolServer
docker-compose up
Refer here for detailed information about our ToolServer.
After setting up ToolServer, you can start to run XAgent.
- Install requirements (Require Python >= 3.10)
pip install -r requirements.txt
-
Configure XAgent You should configure XAgent in
config.yml
before running it. At least one OpenAI key is provided inconfig.yml
, which is used to access OpenAI API. We highly recommend usinggpt-4-32k
to run XAgent,gpt-4
is also OK for most simple tasks. In any case, at least onegpt-3.5-turbo-16k
API key should be provided as a backup model. We do not test or recommend usinggpt-3.5-turbo
to run XAgent due to very limited context length, you should not try to run XAgent on that. -
Run XAgent
python run.py --task "put your task here" --model "gpt-4"
You can use argument --upload_files
to select files you want to submit to XAgent.
The local workspace for your XAgent is in local_workspace
, where you can find all the files generated by XAgent throughout the running process. Besides, in running_records
you can find all the intermediate steps information, e.g. task statuses, LLM's input-output pairs, used tools, etc.
After execution, the full workspace
in ToolServerNode
will be copied to running_records
for your convenience.
- Run XAgent with GUI
cd XAgentServer
docker-compose up
# also, you can start with python
# python3.10+ is required
cd XAgentServer
pip install -r requirements.txt
cd ..
python start_server.py
# you can run web page with following command as well:
cd ../XAgentWeb
npm install
npm run dev
Build the docker image for XAgent-Server and start the docker container.
You will see the XAgent Server listening on port 8090
.
Refer here for the detailed information about our GUI Demo.
Here we also show some cases of solving tasks by XAgent: You can check our live demo on XAgent Official Website. We also provide a video demo and show cases of using XAgent here:
We start with a case of aiding users in intricate data analysis. Here, our user submitted an iris.zip
file to XAgent, seeking assistance in data analysis. XAgent swiftly broke down the task into four sub-tasks: (1) data inspection and comprehension, (2) verification of the system's Python environment for relevant data analysis libraries, (3) crafting data analysis code for data processing and analysis, and (4) compiling an analytical report based on the Python code's execution results.
Here is a figure drawn by XAgent.
Empowered with the unique capability to actively seek human assistance and collaborate in problem-solving, XAgent continues to redefine the boundaries of human-agent cooperation. As depicted in screenshot below, a user sought XAgent's aid in recommending some great restaurants for a friendly gathering, yet failed to provide specific details. Recognizing the insufficiency of the provided information, XAgent employed the AskForHumanHelp tool, prompting human intervention to elicit the user's preferred location, budget constraints, culinary preferences, and any dietary restrictions. Armed with this valuable feedback, XAgent seamlessly generated tailored restaurant recommendations, ensuring a personalized and satisfying experience for the user and their friends.
XAgent not only tackles mundane tasks but also serves as an invaluable aid in complex tasks such as model training. Here we show a scenario where a user desires to analyze movie reviews and evaluate the public sentiment surrounding particular films. In response, XAgent promptly initiates the process by downloading the IMDB dataset to train a cutting-edge BERT model (see screenshot below), harnessing the power of deep learning. Armed with this trained BERT model, XAgent seamlessly navigates the intricate nuances of movie reviews, offering insightful predictions regarding the public's perception of various films.
We conduct human preference evaluation to evaluate XAgent's performance. We prepare over 50 real-world complex tasks for evaluation, which can be categorized into 5 classes: Search and Report, Coding and Developing, Data Analysis, Math, and Life Assistant. We compare the results of XAgent with AutoGPT, which shows a total win of XAgent over AutoGPT. All running records will be released soon.
We report a significant improvement of XAgent over AutoGPT in terms of human preference.
We also evaluate XAgent on the following benchmarks:
Our blog is available at here!
If you find our repo useful, please kindly consider citing:
@misc{xagent2023,
title={XAgent: An Autonomous Agent for Complex Task Solving},
author={XAgent Team},
year={2023},
}