Home

Awesome

OpenAgents: An Open Platform for Language Agents in the Wild

<a href="https://arxiv.org/abs/2310.10634" target="_blank"> <img alt="OpenAgents Paper" src="https://img.shields.io/badge/πŸ“‘-OpenAgents_Paper-blue" /> </a> <a href="https://chat.xlang.ai" target="_blank"> <img alt="Online Demos" src="https://img.shields.io/badge/πŸ₯‘-Online_Demos-blue" /> </a> <a href="https://xlang.ai" target="_blank"> <img alt="XLangNLPLab" src="https://img.shields.io/badge/πŸ§ͺ-XLANG_NLP_Lab-blue" /> </a> <a href="https://docs.xlang.ai" target="_blank"> <img alt="User Manual" src="https://img.shields.io/badge/πŸ“–-User_Manual-blue" /> </a> <a href="https://opensource.org/license/apache-2-0" target="_blank"> <img alt="License: apache-2-0" src="https://img.shields.io/github/license/saltstack/salt" /> </a> <a href="https://github.com/xlang-ai/OpenAgents" target="_blank"> <img alt="GitHub Stars" src="https://img.shields.io/github/stars/xlang-ai/OpenAgents?style=social" /> </a> <a href="https://github.com/xlang-ai/OpenAgents/issues" target="_blank"> <img alt="Open Issues" src="https://img.shields.io/github/issues-raw/xlang-ai/OpenAgents" /> </a> <a href="https://twitter.com/XLangNLP" target="_blank"> <img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/XLANG NLP Lab" /> </a> <a href="https://join.slack.com/t/xlanggroup/shared_invite/zt-20zb8hxas-eKSGJrbzHiPmrADCDX3_rQ" target="_blank"> <img alt="Join Slack" src="https://img.shields.io/badge/Slack-join-blueviolet?logo=slack&amp" /> </a> <a href="https://discord.gg/4Gnw7eTEZR" target="_blank"> <img alt="Discord" src="https://dcbadge.vercel.app/api/server/4Gnw7eTEZR?compact=true&style=flat" /> </a> <div align="center"> <img src="pics/openagents_overview.png"/> </div> <p align="center"> <a>English</a> β€’ <a href="README_ZH.md">δΈ­ζ–‡</a> β€’ <a href="README_JA.md">ζ—₯本θͺž</a> β€’ <a href="README_KO.md">ν•œκ΅­μ–΄</a> </p>

Current language agent frameworks aim to facilitate the construction of proof-of-concept language agents while neglecting the non-expert user access to agents and paying little attention to application-level designs. We built OpenAgents, an open platform for using and hosting language agents in the wild of everyday life.

We have now implemented three agents in OpenAgents, and we host them on demo for free use!

  1. Data Agent for data analysis with Python/SQL and data tools;
  2. Plugins Agent with 200+ daily tools;
  3. Web Agent for autonomous web browsing.

OpenAgents can analyze data, call plugins, control your browser as ChatGPT Plus, but with OPEN Code for

  1. Easy deployment
  2. Full stack
  3. Chat Web UI
  4. Agent methods
  5. …

OpenAgents enables general users to interact with agent functionalities through a web UI optimized for swift responses and common failures, while offering developers and researchers a seamless deployment experience on local setups, providing a foundation for crafting innovative language agents and facilitating real-world evaluations. We elucidate both the challenges and promising opportunities, aspiring to set a foundation for future research and development of real-world language agents.

We welcome contributions from everyone. Before you start, please take a moment to read our CONTRIBUTING.md guidelines for issues and PRs. This will help ensure that your contribution process is smooth and consistent with the project’s standards.

πŸ”« Trouble Shooting

Join our Discord for help if you encounter any issues with our online demo or local deployment. Alternatively, create an issue if you have trouble with features or code.

πŸ”₯ News

πŸ₯‘ OpenAgents

We built three real-world agents with chat-based web UI as demonstration(check OpenAgents demos). Here is a brief overview of our OpenAgents platform. You can find more details about concepts & designs in our documentation.

Data Agent

Data Agent is a comprehensive toolkit designed for efficient data operations. It provides capabilities to:

With its proficiency in writing and executing code, Data Agent simplifies a wide range of data-centric tasks. Discover its potential through various use cases.

<div align="center"> <img src="pics/data_agent.png" width="784"/> </div> <details> <summary>Click to see more use case screenshots</summary> <div align="center"> <img src="pics/data_agent_demo.png" width="784"/> </div> </details>

Plugins Agent

Plugins Agent seamlessly integrates with over 200 third-party plugins, each handpicked to enrich various facets of your daily life. With these plugins at its disposal, the agent empowers you to tackle a wide range of tasks and activities more efficiently.

πŸ”Œ Sample Plugins Include:

Combined Plugin Usage

Harness the power of synergy! Plugins Agent supports the concurrent use of multiple plugins. Planning a trip? Seamlessly integrate functionalities from Klook, Currency converter, and WeatherViz.

Auto Plugin Selection

Simplify your choices with our Auto Plugin Selection feature. Let the agent intuitively search and suggest the best plugins tailored to your needs.

Dive into more use cases to see Plugins Agent in action.

<div align="center"> <img src="pics/plugins_agent.png" width="784"/> </div> <details> <summary>Click to see more use case screenshots</summary> <div align="center"> <img src="pics/plugins_agent_demo.png" width="784"/> </div> </details>

Web Agent

Web Agent harnesses the power of a Chrome extension to navigate and explore websites automatically. This agent streamlines the web browsing experience, making it easier to find relevant information, access desired resources, and so on.

Examples of What Web Agent Can Do:

Witness the full potential of Web Agent in these use cases.

<div align="center"> <img src="pics/web_agent.png" width="784"/> </div> <details> <summary>Click to see more use case screenshots</summary> <div align="center"> <img src="pics/web_agent_demo.png" width="784"/> </div> </details>

πŸ’» Localhost Deployment

We've released the OpenAgents platform code. Feel free to deploy on your own localhost!

Here is a brief system design of OpenAgents:

<div align="center"> <img src="pics/system_design.png"/> </div>

From Source Code

Please check the following folders and README files to set up & localhost:

  1. Backend: the flask backend to host our three agents.
  2. Frontend: the frontend UI and WeBot Chrome extension.

p.s.: We have renamed some arguments in code for better readability. If you have pulled the code before 10/26/2023, just a reminder that if you want to you pull the latest code, previous local chat history will be lost because of different key names.

Docker

Please follow the following steps to use the docker-compose to deploy the OpenAgents platform.

Note: the docker is under development, so there may be functions not working properly as expected and slower response. Please feel free to open an issue if you have any questions. If you want a more robust version, currently we recommend you to deploy from source code.

  1. If you want to use kaggle's dataset, you must modify the information in the Dockerfile to your correct information.
ENV KAGGLE_USER="" \
    KAGGLE_KEY="" 
  1. If you are not running locally, you need to modify the accessible IP to the backend service in frontend/Dockerfile
ENV NEXT_PUBLIC_BACKEND_ENDPOINT http://x.x.x.x:8000
  1. Run the docker compose build command in the project root directory.
  2. If you use openai unofficial services, such as FastChat, you need to modify OPENAI_API_BASE in docker-compose.yml;otherwise you only to put your OPENAI_API_KEY in docker-compose.yml
  3. After completing the above steps, you can run docker compose up -d to start all services.

Notice:

  1. If you want to use GPU, you need install Nvidia Container Toolkit,and uncomment the the docker-compose.yml Lines 56-62.
  2. Use Auto Plugin will download the weight file from huggingface. In some areas, connection timeout may occur. Please solve the network problem by yourself.

πŸ“œ Tutorial on Extending OpenAgents

Code Structure

Before we dive into how to extend OpenAgents, let's first take a glance at the code structure for better understanding. The code structure of OpenAgents is shown below:

β”œβ”€β”€ backend  # backend code
β”‚Β Β  β”œβ”€β”€ README.md  # backend README for setup
β”‚Β Β  β”œβ”€β”€ api  # RESTful APIs, to be called by the frontend
β”‚Β Β  β”œβ”€β”€ app.py  # main flask app
β”‚Β Β  β”œβ”€β”€ display_streaming.py  # rendering the streaming response
β”‚Β Β  β”œβ”€β”€ kernel_publisher.py  # queue for code execution
β”‚Β Β  β”œβ”€β”€ main.py  # main entry for the backend
β”‚Β Β  β”œβ”€β”€ memory.py  # memory(storage) for the backend
β”‚Β Β  β”œβ”€β”€ schemas.py  # constant definitions
β”‚Β Β  β”œβ”€β”€ setup_script.sh  # one-click setup script for the backend
β”‚Β Β  β”œβ”€β”€ static  # static files, e.g., cache and figs
β”‚Β Β  └── utils  # utilities
β”œβ”€β”€ frontend  # frontend code
β”‚Β Β  β”œβ”€β”€ README.md  # frontend README for setup
β”‚Β Β  β”œβ”€β”€ components  # React components
β”‚Β Β  β”œβ”€β”€ hooks  # custom React hooks
β”‚Β Β  β”œβ”€β”€ icons  # icon assets
β”‚Β Β  β”œβ”€β”€ next-env.d.ts  # TypeScript declarations for Next.js environment variables
β”‚Β Β  β”œβ”€β”€ next-i18next.config.js  # configuration settings for internationalization
β”‚Β Β  β”œβ”€β”€ next.config.js  # configuration settings for Next.js
β”‚Β Β  β”œβ”€β”€ package-lock.json  # generated by npm that describes the exact dependency tree
β”‚Β Β  β”œβ”€β”€ package.json  # manifest file that describes the dependencies
β”‚Β Β  β”œβ”€β”€ pages  # Next.js pages
β”‚Β Β  β”œβ”€β”€ postcss.config.js  # configuration settings for PostCSS
β”‚Β Β  β”œβ”€β”€ prettier.config.js  # configuration settings for Prettier
β”‚Β Β  β”œβ”€β”€ public  # static assets
β”‚Β Β  β”œβ”€β”€ styles  # global styles
β”‚Β Β  β”œβ”€β”€ tailwind.config.js  # configuration settings for Tailwind CSS
β”‚Β Β  β”œβ”€β”€ tsconfig.json  # configuration settings for TypeScript
β”‚Β Β  β”œβ”€β”€ types  # type declarations
β”‚Β Β  β”œβ”€β”€ utils  # utilities or helper functions
β”‚Β Β  β”œβ”€β”€ vitest.config.ts  # configuration settings for ViTest
β”‚Β Β  └── webot_extension.zip  # Chrome extension for Web Agent
└── real_agents  # language agents
    β”œβ”€β”€ adapters  # shared components for the three agents to adapt to the backend
    β”œβ”€β”€ data_agent  # data agent implementation
    β”œβ”€β”€ plugins_agent  # plugins agent implementation
    └── web_agent  # web agent implementation

As shown, backend/ and frontend/ are self-contained and directly deployable (see here). It does not mean they cannot be modified. Instead, you can just follow the conventional client-server architecture to extend the backend and frontend as you wish. For real_agents/, we design it to be "one agent, one folder", so that it is easy to extend a new agent. It is worth noting that we name it "real agents" because not only the conceptual language agent part is included, but also the gaps between the language agent and the backend are filled here. For example, adapters/ contains the shared adapter components like stream parsing, data model, memory, callbacks, etc. We refer interested readers to our paper for concepts and implementation designs. And we thank LangChain as we base on their code to build real agents.

Extend A New Agent

If you want to build a new agent beyond the three agents we provide, you can follow the steps below:

Note, if new data types, i.e., beyond text, image, table, and json, you may need to implement its parsing logic in backend/display_streaming.py and add new data models.

Extend A New LLM

Extending a new LLM as the agent backbone is simpler if the LLM is already hosted and can be called via API. Just register your new model in backend/api/language_model.py. Just refer to lemur-chat as a template.

If the LLM is not hosted yet, we have a tutorial on how to deploy a new LLM and expose it as an API here (LLM hosting to todo).

Extend A New Tool

If you want to extend a new tool in Plugins Agent, you can follow the steps below:

πŸ‘ Contributing

Thanks to open-sourced communities’ efforts, such as LangChain, ChatBot UI, Taxy.ai browser extension and others. We are able to build our interface prototype much more conveniently and efficiently.

We welcome contributions and suggestions, together we move further to make it better! Following the steps will be well-received:

Before you start, we highly recommend taking a moment to check here before contribution.

πŸ“– Documentation

Please check here for full documentation, which will be updated to stay on pace with the demo changes and the code release.

πŸ§™β€Participants

Tech Lead

<a href="https://github.com/Impavidity"><img src="https://avatars.githubusercontent.com/u/9245607?v=4" width="50" /></a>

Co-Lead Contributors

<a href="https://github.com/BlankCheng"><img src="https://avatars.githubusercontent.com/u/34505296?v=4" width="50" /></a> <a href="https://github.com/koalazf99"><img src="https://avatars.githubusercontent.com/u/37338733?v=4" width="50" /></a> <a href="https://github.com/Timothyxxx"><img src="https://avatars.githubusercontent.com/u/47296835?v=4" width="50" /></a>

Key Contributors

<a href="https://github.com/taogoddd"><img src="https://avatars.githubusercontent.com/u/98326623?v=4" width="50" /></a> <a href="https://github.com/WhiteWolf82"><img src="https://avatars.githubusercontent.com/u/48792453?v=4" width="50" /></a> <a href="https://github.com/ztjhz"><img src="https://avatars.githubusercontent.com/u/59118459?v=4" width="50" /></a>

Valuable Contributors

<a href="https://github.com/BillStark001"><img src="https://avatars.githubusercontent.com/u/31788509?v=4" width="50" /></a> <a href="https://github.com/SivilTaram"><img src="https://avatars.githubusercontent.com/u/10275209?v=4" width="50" /></a> <a href="https://github.com/che330"><img src="https://avatars.githubusercontent.com/u/122778503?v=4" width="50" /></a> <a href="https://github.com/leo-liuzy"><img src="https://avatars.githubusercontent.com/u/11146950?v=4" width="50" /></a> <a href="https://github.com/ranpox"><img src="https://avatars.githubusercontent.com/u/25601999?v=4" width="50" /></a> <a href="https://github.com/hongjin-su"><img src="https://avatars.githubusercontent.com/u/114016954?v=4" width="50" /></a> <a href="https://github.com/QIN2DIM"><img src="https://avatars.githubusercontent.com/u/62018067?v=4" width="50" /></a> <a href="https://github.com/xJQx"><img src="https://avatars.githubusercontent.com/u/47933193?v=4" width="50" /></a> <a href="https://github.com/thomasshin"><img src="https://avatars.githubusercontent.com/u/76890354?v=4" width="50" /></a>

Acknowledgments (beyond code)

Heartfelt appreciation to Ziyi Huang, Roxy Rong, Haotian Li, Xingbo Wang, Jansen Wong, and Chen Henry Wu for their valuable contributions to the OpenAgents. Their expertise and insights were instrumental in bringing this project to fruition!

Open Source Contributors

Thanks to all the contributors!

<a href="https://github.com/xlang-ai/OpenAgents/graphs/contributors"> <img src="https://contrib.rocks/image?repo=xlang-ai/OpenAgents" /> </a>

Citation

If you find our work helpful, please cite us:

@misc{OpenAgents,
      title={OpenAgents: An Open Platform for Language Agents in the Wild}, 
      author={Tianbao Xie and Fan Zhou and Zhoujun Cheng and Peng Shi and Luoxuan Weng and Yitao Liu and Toh Jing Hua and Junning Zhao and Qian Liu and Che Liu and Leo Z. Liu and Yiheng Xu and Hongjin Su and Dongchan Shin and Caiming Xiong and Tao Yu},
      year={2023},
      eprint={2310.10634},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Acknowledgments

We would like to thank Google Research, Amazon AWS, and Salesforce Research for their research gift funds to this open-source effort!

<div align="center"> <img src="pics/transparent.png" width="20" style="pointer-events: none;"> <a href="https://www.salesforceairesearch.com/"> <img src="pics/salesforce.webp" alt="Salesforce Research" height = 30/> </a> <img src="pics/transparent.png" width="20" style="pointer-events: none;"> <a href="https://research.google/"> <img src="pics/google_research.svg" alt="Google Research" height = 30/> </a> <img src="pics/transparent.png" width="25" style="pointer-events: none;"> <a href="https://www.amazon.science/" style="display: inline-block; margin-bottom: -100px;"> <img src="pics/amazon.svg" alt="Amazon AWS" height = 20 /> </a> </div>

⭐️ Star History

Star History Chart

<h3 align="center"> A ⭐️ to <b>OpenAgents</b> is to make it shine brighter and benefit more people. </h3>