Skip to content

Commit 80b8e99

Browse files
committed
Upload agents2.0
1 parent 350246d commit 80b8e99

File tree

12,714 files changed

+605719
-74588
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

12,714 files changed

+605719
-74588
lines changed

.gitignore

+173-40
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,173 @@
1-
# Ignore Python bytecode files
2-
__pycache__
3-
4-
# Ignore logs
5-
logs
6-
7-
# Ignore sensitive data file
8-
sensitive.txt
9-
10-
# Ignore generated JSON files
11-
yc_final.json
12-
template.json
13-
14-
# Ignore generated output code
15-
output_code
16-
17-
# Ignore Visual Studio Code settings
18-
.vscode
19-
20-
# Ignore example-related files
21-
examples/__pycache__
22-
examples/logs
23-
examples/temp_database
24-
examples/temp_agent
25-
26-
# Ignore source distribution and egg info
27-
/src/agent.egg-info
28-
/src/dist
29-
30-
# Ignore agent logs
31-
/src/agents/logs
32-
33-
# Ignore version control history
34-
.git
35-
.history
36-
src/ai_agents.egg-info/dependency_links.txt
37-
src/ai_agents.egg-info/PKG-INFO
38-
src/ai_agents.egg-info/requires.txt
39-
src/ai_agents.egg-info/SOURCES.txt
40-
src/ai_agents.egg-info/top_level.txt
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158+
# and can be added to the global gitignore or merged into this file. For a more nuclear
159+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160+
.idea/
161+
162+
163+
# other
164+
*.iml
165+
*.pyc
166+
167+
# Dev
168+
logs/
169+
src/logs/
170+
test/
171+
memory/
172+
examples/document-processing/logs/
173+
!src/agents/datasets/data/math/test

README.md

+45-94
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,67 @@
1-
2-
# <p align="center"><img src='./assets/agents-logo.png' width=300> </p>
3-
## <p align="center" style="display:inline-block;"><font face="Calisto MT"><font size="4">An Open-source Framework for Autonomous Language Agents</font></font></p>
4-
5-
<p align="center"><a href="https://arxiv.org/pdf/2309.07870.pdf">[📄 Paper]</a> <a href="https://agents-readthedocsio.readthedocs.io/en/latest/index.html">[📄 Doc]</a>
6-
<a href="http://www.aiwaves-agents.com/">[🌐 Website]</a>
7-
<a href="#web-demos">[🤖️ Demos]</a> <a href="https://discord.gg/DDPBeFt7">[🔥 Discord]</a> <a href='./assets/wechat.jpg'>[🔥 Wechat Group] </a>
1+
<div align="center">
2+
<img src='./assets/agents-logo.png' width=300px>
3+
4+
## <p align="center">Symbolic Learning Enables Self-Evolving Agents</p>
5+
6+
<p align="center">
7+
<a href="https://oe-heart.github.io/Agents2.0/">[🤖Project]</a>
8+
<a href="">[📄Paper]</a>
9+
<a href="https://agentsv2.readthedocs.io/">[📝Docs]</a>
10+
<a href="#overview">[🌟Overview]</a>
11+
<a href="#installation">[🔧Installation]</a>
12+
<a href="#citation">[🚩Citation]</a>
813
</p>
9-
</p>
10-
<hr>
11-
12-
13-
## Overview
14-
15-
**Agents** is an open-source library/framework for building autonomous language agents. The library is carefully engineered to support important features including **long-short term memory**, **tool usage**, **web navigation**, **multi-agent communication**, and brand new features including **human-agent interaction** and **symbolic control**. With **Agents**, one can customize a language agent or a multi-agent system by simply filling in a config file in natural language and deploy the language agents in a terminal, a Gradio interface, or a backend service.
16-
17-
One major difference between **Agents** and other existing frameworks for language agents is that our framework allows users to provide fine-grained control and guidance to language agents via an **SOP (Standard Operation Process)**. An SOP defines subgoals/subtasks for the overall task and allows users to customize a fine-grained workflow for the language agents.
18-
19-
<p align="center"><img src='./assets/agents-cover.png' width=800></p>
20-
21-
## 📢 Updates
22-
23-
[x] 2023.10.7 **Support LLM-based SOP generation**🎉🎉🎉🎉
24-
- [SOP Generation for Multi-Agent](https://huggingface.co/spaces/AIWaves/SOP_Generation-multi)[on Huggingface Space]
25-
- [SOP Generation for Single-Agent](https://huggingface.co/spaces/AIWaves/SOP_Generation-single)[on Huggingface Space]
26-
- We recommend strongly that you can create your OWN DEMO by clicking the three dots at the top right and selecting **Duplicate this Space** on Huggingface Space.
27-
28-
[x] 2023.9.20 Deploy Demos on Huggingface Space
29-
30-
[x] 2023.9.12 Official Release
31-
32-
## 💡 Highlights
33-
34-
- **Long-short Term Memory**: Language agents in the library are equipped with both long-term memory implemented via VectorDB + Semantic Search and short-term memory (working memory) maintained and updated by an LLM.
35-
- **Tool Usage**: Language agents in the library can use any external tools via [function-calling](https://platform.openai.com/docs/guides/gpt/function-calling) and developers can add customized tools/APIs [here](https://github.com/aiwaves-cn/agents/blob/master/src/agents/Component/ToolComponent.py).
36-
- **Web Navigation**: Language agents in the library can use search engines to navigate the web and get useful information.
37-
- **Multi-agent Communication**: In addition to single language agents, the library supports building multi-agent systems in which language agents can communicate with other language agents and the environment. Different from most existing frameworks for multi-agent systems that use pre-defined rules to control the order for agents' action, **Agents** includes a *controller* function that dynamically decides which agent will perform the next action using an LLM by considering the previous actions, the environment, and the target of the current states. This makes multi-agent communication more flexible.
38-
- **Human-Agent interaction**: In addition to letting language agents communicate with each other in an environment, our framework seamlessly supports human users to play the role of the agent by himself/herself and input his/her own actions, and interact with other language agents in the environment.
39-
- **Symbolic Control**: Different from existing frameworks for language agents that only use a simple task description to control the entire multi-agent system over the whole task completion process, **Agents** allows users to use an **SOP (Standard Operation Process)** that defines subgoals/subtasks for the overall task to customize fine-grained workflows for the language agents.
40-
41-
42-
## 🛠 Installation
43-
44-
#### Option 1. Build from source
4514

46-
47-
git clone https://github.com/aiwaves-cn/agents.git
48-
cd agents
49-
pip install -e .
50-
15+
![](https://img.shields.io/badge/version-v2.0.0-blue)
16+
[![License: Apache](https://img.shields.io/badge/License-Apache2.0-yellow.svg)](https://opensource.org/license/apache-2-0)
17+
![](https://img.shields.io/github/last-commit/aiwaves-cn/agents?color=green)
18+
![](https://img.shields.io/badge/PRs-Welcome-red)
5119

52-
#### Option 2. Install via PyPI
20+
---
5321

54-
55-
pip install ai-agents
56-
22+
</div>
5723

58-
## 📦 Usage
59-
### 🛠️ Generate the config file
6024

61-
#### Option 1. Fill in the config template manually
25+
## 🔔News
26+
- [2024-06-25] We release new agents2.0, supporting for agent evaluation and optimazation.
27+
---
6228

63-
Modify `example/{Muti|Single_Agent}/{target_agent}/config.json`
29+
## 🌟Overview
6430

65-
#### Option 2. Try our [WebUI](http://www.aiwaves.cn/create-agent/) for customizing the config file.
31+
Agent symbolic learning is a systematic framework for training language agents, which is inspired by the connectionist learning procedure used for training neural nets. We make an analogy between language agents and neural nets: the agent pipeline of an agent corresponds to the computational graph of a neural net, a node in the agent pipeline corresponds to a layer in the neural net, and the prompts and tools for a node correspond to the weights of a layer. In this way, we are able to implement the main components of connectionist learning, i.e., backward propagation and gradient-based weight update, in the context of agent training using language-based loss, gradients, and weights.
6632

67-
Haven't figured out how to write the JSON file yet? Check out our [documentation](https://agents-readthedocsio.readthedocs.io/en/latest/index.html)!
33+
<img src='./assets/overview.png'>
6834

69-
#### Option 3. Try Huggingface Space for generating the SOP automatically.
35+
We implement loss function, back-propagation, and weight optimizer in the context of agent training with carefully designed prompt pipelines. For a training example, our framework first conducts the "forward pass" (agent execution) and stores the input, output, prompts, and tool usage in each node in a "trajectory". We then use a prompt-based loss function to evaluate the outcome, resulting in a "language loss". Afterward, we back-propagate the language loss from the last to the first node along the trajectory, resulting in textual analyses and reflections for the symbolic components within each node, we call them language gradients. Finally, we update all symbolic components in each node, as well as the computational graph consisting of the nodes and their connections, according to the language gradients with another carefully designed prompt. Our approach also naturally supports optimizing multi-agent systems by considering nodes as different agents or allowing multiple agents to take actions in one node.
7036

71-
- [SOP Generation for Multi-Agent](https://huggingface.co/spaces/AIWaves/SOP_Generation-multi)[on Huggingface Space]
72-
- [SOP Generation for Single-Agent](https://huggingface.co/spaces/AIWaves/SOP_Generation-single)[on Huggingface Space]
73-
- We recommend strongly that you can create your OWN DEMO by clicking the three dots at the top right and selecting **Duplicate this Space** on Huggingface Space.
37+
---
7438

75-
### 🤖️ The Agent Hub
76-
77-
We provide an **AgentHub**, where you can search for interesting Agents shared by us or other developers, try them out or use them as the starting point to customize your own agent. We encourage you to share your customized agents to help others build their own agents more easily! You can share your customized agents by submitting PRs that adds configs and customized codes [here](https://github.com/aiwaves-cn/agents/tree/master/examples/Community_Agent). You can also send us your own config files and codes for customized agents by [email](mailto:[email protected]), and we will share your examples and acknowledge your contribution in future updates!
78-
79-
80-
81-
## 📷 Examples and Demos
82-
83-
We have provided exemplar config files, code, and demos for both single-agent and multi-agent systems [here](https://github.com/aiwaves-cn/agents/tree/master/examples).
84-
85-
### Web demos
86-
#### Note
87-
1.Due to massive traffic, our online demos may suffer from long queue time and unstable issues. **Please follow our [quick start guide](https://github.com/aiwaves-cn/agents/blob/master/examples/README.md)) and deploy language agents locally for testing. Or checkout our [website](http://www.aiwaves-agents.com/)**.
88-
2.Software Company is unable to generate executable code online, **if you wish to generate executable code directly, please run it locally :)**
89-
- [Customer Service Agent](https://www.aiwaves.cn/customer-service-agent/)
90-
- [Debate](https://huggingface.co/spaces/AIWaves/Debate)[now on Huggingface Space]
91-
- [Software Company](https://huggingface.co/spaces/AIWaves/Software_Company)[now on Huggingface Space]
92-
- [Fiction Studio](https://www.aiwaves.cn/fiction-studio/)
93-
94-
95-
## Contributing to Agents
96-
We appreciate your interest in contributing to our open-source initiative. Please feel free to submit a PR or share your thoughts on how to improve the library in Issues!
97-
98-
## Note:
99-
1. When running the code, we will download an embedding model, which will cause the code to run slowly. We will adjust it to the API interface later
100-
2. Currently, the shopping assistant cannot be used. We will replace the API later. Stay tuned
39+
## 🔧Installation
10140

41+
**Installation from git repo branch:**
42+
```
43+
pip install git+https://github.com/aiwaves-cn/agents@master
44+
```
10245

103-
## 📚 Documentation
46+
**Installation for local development:**
47+
```
48+
git clone -b master https://github.com/aiwaves-cn/agents
49+
cd agents
50+
pip install -e .
51+
```
10452

105-
Please check our [documentation](https://agents-readthedocsio.readthedocs.io/en/latest/index.html) for detailed documentation of the framework.
53+
---
10654

10755
## ⭐ Star History
10856
[![Star History Chart](https://api.star-history.com/svg?repos=aiwaves-cn/agents&type=Date)](https://star-history.com/#aiwaves-cn/agents&Date)
10957

110-
## Citation
111-
If you find our repo useful in your research, please kindly consider cite:
112-
```angular2
113-
@misc{zhou2023agents,
58+
---
59+
60+
## 🚩Citation
61+
62+
If you find our repository useful in your research, please kindly consider cite:
63+
```bibtex
64+
@article{zhou2023agents,
11465
title={Agents: An Open-source Framework for Autonomous Language Agents},
11566
author={Wangchunshu Zhou and Yuchen Eleanor Jiang and Long Li and Jialong Wu and Tiannan Wang and Shi Qiu and Jintian Zhang and Jing Chen and Ruipu Wu and Shuai Wang and Shiding Zhu and Jiyu Chen and Wentao Zhang and Ningyu Zhang and Huajun Chen and Peng Cui and Mrinmaya Sachan},
11667
year={2023},

agents-cover.png

-1 MB
Binary file not shown.

assets/agents-cover.pdf

-498 KB
Binary file not shown.

assets/agents-cover.png

-639 KB
Binary file not shown.

assets/algorithm.png

151 KB
Loading

assets/case.png

210 KB
Loading

assets/main_results.png

53.9 KB
Loading

assets/other_results.png

58.3 KB
Loading

assets/overview.png

441 KB
Loading

assets/wechat.jpg

-142 KB
Binary file not shown.

assets/workflow.png

364 KB
Loading

0 commit comments

Comments
 (0)