{"id":13465350,"url":"https://github.com/microsoft/TaskWeaver","last_synced_at":"2025-03-25T16:31:38.301Z","repository":{"id":210013503,"uuid":"689849471","full_name":"microsoft/TaskWeaver","owner":"microsoft","description":"A code-first agent framework for seamlessly planning and executing data analytics tasks. ","archived":false,"fork":false,"pushed_at":"2024-10-23T07:34:28.000Z","size":29426,"stargazers_count":5302,"open_issues_count":39,"forks_count":669,"subscribers_count":65,"default_branch":"main","last_synced_at":"2024-10-29T15:34:48.730Z","etag":null,"topics":["agent","ai-agents","code-interpreter","copilot","data-analysis","llm","openai"],"latest_commit_sha":null,"homepage":"https://microsoft.github.io/TaskWeaver/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-11T03:17:38.000Z","updated_at":"2024-10-29T03:45:14.000Z","dependencies_parsed_at":"2023-12-25T05:23:15.822Z","dependency_job_id":"25a300df-4bdc-497a-9ae6-bc5e9b83a5ff","html_url":"https://github.com/microsoft/TaskWeaver","commit_stats":{"total_commits":239,"total_committers":20,"mean_commits":11.95,"dds":0.6778242677824268,"last_synced_commit":"b8e30ad5aefda3bae32390f6ca40c3e967ddc265"},"previous_names":["microsoft/taskweaver"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FTaskWeaver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FTaskWeaver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FTaskWeaver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2FTaskWeaver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/TaskWeaver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222088539,"owners_count":16928976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","ai-agents","code-interpreter","copilot","data-analysis","llm","openai"],"created_at":"2024-07-31T15:00:28.069Z","updated_at":"2025-03-25T16:31:38.291Z","avatar_url":"https://github.com/microsoft.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003e\n    \u003cimg src=\"./.asset/logo.color.svg\" width=\"45\" /\u003e TaskWeaver\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Discord Follow](https://dcbadge.vercel.app/api/server/Z56MXmZgMb?style=flat)](https://discord.gg/Z56MXmZgMb) \u0026ensp;\n![Python Version](https://img.shields.io/badge/Python-3776AB?\u0026logo=python\u0026logoColor=white-blue\u0026label=3.10%20%7C%203.11)\u0026ensp;\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\u0026ensp;\n![Welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)\n\n\u003c/div\u003e\n\nTaskWeaver is A **code-first** agent framework for seamlessly planning and executing data analytics tasks. \nThis innovative framework interprets user requests through code snippets and efficiently coordinates a variety \nof plugins in the form of functions to execute data analytics tasks in a stateful manner.\n\nUnlike many agent frameworks that only track the chat history with LLMs in text, TaskWeaver preserves both the **chat history** and the **code execution history**, including the in-memory data. This feature enhances the *expressiveness* of the agent framework, making it ideal for processing complex data structures like high-dimensional tabular data.\n\n\u003ch1 align=\"center\"\u003e\n    \u003cimg src=\"./.asset/taskweaver_arch.png\"/\u003e \n\u003c/h1\u003e\n\n\n## 🆕 News\n- 📅2025-03-13: TaskWeaver now supports vision input for the Planner role. Please check the [vision input](https://microsoft.github.io/TaskWeaver/blog/vision) for more details.👀\n- 📅2025-01-16: TaskWeaver has been enhanced with an experimental role called [Recepta](https://microsoft.github.io/TaskWeaver/blog/reasoning) for its reasoning power.🧠\n- 📅2024-12-23: TaskWeaver has been integrated with the [AgentOps](https://microsoft.github.io/TaskWeaver/docs/observability) for better observability and monitoring.🔍\n- 📅2024-09-13: We introduce the shared memory to store information that is shared between the roles in TaskWeaver. Please check the [memory](https://microsoft.github.io/TaskWeaver/docs/memory) for more details.🧠\n- 📅2024-09-13: We have enhanced the experience feature by allowing static and dynamic experience selection. Please check the [experience](https://microsoft.github.io/TaskWeaver/blog/experience) for more details.📚 \n- 📅2024-07-02: We have optimized TaskWeaver to support not-that-large language models served locally. Please check this [post](https://microsoft.github.io/TaskWeaver/blog/local_llm) for more details.🔗\n- 📅2024-05-07: We have added two blog posts on [Evaluating a LLM agent](https://microsoft.github.io/TaskWeaver/blog/evaluation) and [Adding new roles to TaskWeaver](https://microsoft.github.io/TaskWeaver/blog/role) in the documentation.📝\n- 📅2024-03-28: TaskWeaver now offers all-in-one Docker image, providing a convenient one-stop experience for users. Please check the [docker](https://microsoft.github.io/TaskWeaver/docs/usage/docker) for more details.🐳\n- 📅2024-03-27: TaskWeaver now switches to `container` mode by default for code execution. Please check the [code execution](https://microsoft.github.io/TaskWeaver/docs/code_execution) for more details.🐳\n\u003c!-- - 📅2024-03-07: TaskWeaver now supports configuration of different LLMs for various components, such as the Planner and CodeInterpreter. Please check the [multi-llm](https://microsoft.github.io/TaskWeaver/docs/llms/multi-llm) for more details.🔗 --\u003e\n\u003c!-- - 📅2024-03-04: TaskWeaver now supports a [container](https://microsoft.github.io/TaskWeaver/docs/code_execution) mode, which provides a more secure environment for code execution.🐳 --\u003e\n\u003c!-- - 📅2024-02-28: TaskWeaver now offers a [CLI-only](https://microsoft.github.io/TaskWeaver/docs/advanced/cli_only) mode, enabling users to interact seamlessly with the Command Line Interface (CLI) using natural language.📟 --\u003e\n\u003c!-- - 📅2024-02-01: TaskWeaver now has a plugin [document_retriever](https://github.com/microsoft/TaskWeaver/blob/main/project/plugins/README.md#document_retriever) for RAG based on a knowledge base.📚 --\u003e\n\u003c!-- - 📅2024-01-30: TaskWeaver introduces a new plugin-only mode that securely generates calls to specified plugins without producing extraneous code.🪡 --\u003e \n\u003c!-- - 📅2024-01-23: TaskWeaver can now be personalized by transforming your chat histories into enduring [experiences](https://microsoft.github.io/TaskWeaver/docs/customization/experience) 🎉 --\u003e\n\u003c!-- - 📅2024-01-17: TaskWeaver now has a plugin [vision_web_explorer](https://github.com/microsoft/TaskWeaver/blob/main/project/plugins/README.md#vision_web_explorer) that can open a web browser and explore websites.🌐 --\u003e\n\u003c!-- - 📅2024-01-15: TaskWeaver now supports Streaming♒ in both UI and command line.✌️ --\u003e\n\u003c!-- - 📅2024-01-01: Welcome join TaskWeaver [Discord](https://discord.gg/Z56MXmZgMb). --\u003e\n\u003c!-- - 📅2023-12-21: TaskWeaver now supports a number of LLMs, such as LiteLLM, Ollama, Gemini, and QWen🎈.) --\u003e\n\u003c!-- - 📅2023-12-21: TaskWeaver Website is now [available]\u0026#40;https://microsoft.github.io/TaskWeaver/\u0026#41; with more documentations.) --\u003e\n\u003c!-- - 📅2023-12-12: A simple UI demo is available in playground/UI folder, try it [here](https://microsoft.github.io/TaskWeaver/docs/usage/webui)! --\u003e\n- ......\n- 📅2023-11-30: TaskWeaver is released on GitHub🎈.  \n\n\n## 💥 Highlights\n\n- [x] **Planning for complex tasks** - TaskWeaver, which features task decomposition and progress tracking, is designed to solve complex tasks.\n- [x] **Reflective execution** - TaskWeaver supports reflective execution, which allows the agent to reflect on the execution process and make adjustments.\n- [x] **Rich data structure** - TaskWeaver allows you to work with rich data structures in Python, such as DataFrames, instead of dealing with strings.\n- [x] **Customized algorithms** - TaskWeaver allows you to encapsulate your own algorithms into plugins and orchestrate them.\n- [x] **Incorporating domain-specific knowledge** - TaskWeaver is designed to incorporate domain-specific knowledge easily to improve the reliability.\n- [x] **Stateful execution** - TaskWeaver is designed to support stateful execution of the generated code to ensure consistent and smooth user experience.\n- [x] **Code verification** - TaskWeaver is designed to verify the generated code before execution. It can detect potential issues in the generated code and provide suggestions to fix them.\n- [x] **Easy to use** - TaskWeaver is easy to use with sample plugins, examples and tutorials to help you get started. TaskWeaver offers an open-box experience, allowing users to run it immediately after installation.\n- [x] **Easy to debug** - TaskWeaver is easy to debug with detailed and transparent logs to help you understand the entire process, including LLM prompts, the code generation, and execution process.\n- [x] **Security consideration** - TaskWeaver supports a basic session management to keep different users' data separate. The code execution is separated into different processes to avoid mutal interference.\n- [x] **Easy extension** - TaskWeaver is easy to extend to accomplish more complex tasks with multiple agents as roles and plugins.\n\n## 📚 Asking for Contributions\n\nThere are still many features and improvements can be made. But due to our limited resources, we are not able to implement all of them or the progress will be slow. \nWe are looking forward to your contributions to make TaskWeaver better.\n- [ ] Easy-to-use and maintainable UX/UI\n- [ ] Support for prompt template management\n- [ ] Better plugin experiences, such as displaying updates or stopping in the middle of running the plugin and user confirmation before running the plugin\n- [ ] Async interaction with LLMs\n- [ ] Support for remote code execution\n\n\n## ✨ Quick Start\n\n### 🛠️ Step 1: Installation\nTaskWeaver requires **Python \u003e= 3.10**. It can be installed by running the following command:\n```bash\n# [optional to create conda environment]\n# conda create -n taskweaver python=3.10\n# conda activate taskweaver\n\n# clone the repository\ngit clone https://github.com/microsoft/TaskWeaver.git\ncd TaskWeaver\n# install the requirements\npip install -r requirements.txt\n```\n\nIf you want to install an earlier version of TaskWeaver, you may check the [release](https://github.com/microsoft/TaskWeaver/releases) page, find the tag (e.g., `v0.0.1`) and install it by \n```\npip install git+https://github.com/microsoft/TaskWeaver@\u003cTAG\u003e\n```\n\n### 🖊️ Step 2: Configure the LLMs\nBefore running TaskWeaver, you need to provide your LLM configurations. Taking OpenAI as an example, you can configure `taskweaver_config.json` file as follows. \n\n#### OpenAI\n```json\n{\n  \"llm.api_key\": \"the api key\",\n  \"llm.model\": \"the model name, e.g., gpt-4\"\n}\n```\n\n💡 TaskWeaver also supports other LLMs and advanced configurations, please check the [documents](https://microsoft.github.io/TaskWeaver/docs/overview) for more details. \n\n### 🚩 Step 3: Start TaskWeaver\n\n💡 TaskWeaver has switched to `container` mode by default for code execution, which means the code is run in a container.\nYou may need to install Docker and take care of the dependencies in the container.\nPlease check the [code execution](https://microsoft.github.io/TaskWeaver/docs/code_execution) for more details.\n\n#### ⌨️ Command Line (CLI)\n```bash\n# assume you are in the cloned TaskWeaver folder\npython -m taskweaver -p ./project/\n```\nThis will start the TaskWeaver process and you can interact with it through the command line interface. \nIf everything goes well, you will see the following prompt:\n\n```\n=========================================================\n _____         _     _       __\n|_   _|_ _ ___| | _ | |     / /__  ____ __   _____  _____\n  | |/ _` / __| |/ /| | /| / / _ \\/ __ `/ | / / _ \\/ ___/\n  | | (_| \\__ \\   \u003c | |/ |/ /  __/ /_/ /| |/ /  __/ /\n  |_|\\__,_|___/_|\\_\\|__/|__/\\___/\\__,_/ |___/\\___/_/\n=========================================================\nTaskWeaver: I am TaskWeaver, an AI assistant. To get started, could you please enter your request?\nHuman: ___\n```\n\n####  or 💻 Web UI \nTaskWeaver also supports WebUI for demo purpose, please refer to [web UI docs](https://microsoft.github.io/TaskWeaver/docs/usage/webui) for more details.\n\n#### or 📋 Import as a Library\nTaskWeaver can be imported as a library to integrate with your existing project, more information can be found in [docs](https://microsoft.github.io/TaskWeaver/docs/usage/library)\n\n\n\n## 📖 Documentation\nMore documentations can be found on [TaskWeaver Website](https://microsoft.github.io/TaskWeaver).\n\n\n### ❓Get help \n* ❔GitHub Issues (**Preferred**)\n* [💬 Discord](https://discord.gg/Z56MXmZgMb) for discussion\n* For other communications, please contact taskweaver@microsoft.com\n\n---\n\n\n## 🎬 Demo Examples\n\nThe demos were made based on the [web UI](https://microsoft.github.io/TaskWeaver/docs/usage/webui), which is better for displaying the generated artifacts such as images. \nThe demos could also be conducted in the command line interface. \n\n#### 1️⃣📉 Example 1: Pull data from a database and apply an anomaly detection algorithm\nIn this example, we will show you how to use TaskWeaver to pull data from a database and apply an anomaly detection algorithm.\n\n[Anomaly Detection](https://github.com/microsoft/TaskWeaver/assets/7489260/248b9a0c-d504-4708-8c2e-e004689ee8c6)\n\nIf you want to follow this example, you need to configure the `sql_pull_data` plugin in the `project/plugins/sql_pull_data.yaml` file.\nYou need to provide the following information:\n```yaml\napi_type: azure or openai\napi_base: ...\napi_key: ...\napi_version: ...\ndeployment_name: ...\nsqlite_db_path: sqlite:///../../../sample_data/anomaly_detection.db\n```\nThe `sql_pull_data` plugin is a plugin that pulls data from a database. It takes a natural language request as input and returns a DataFrame as output.\n\nThis plugin is implemented based on [Langchain](https://www.langchain.com/).\nIf you want to follow this example, you need to install the Langchain package:\n```bash\npip install langchain\npip install tabulate\n```\n\n#### 2️⃣🏦 Example 2: Forecast QQQ's price in the next 7 days\nIn this example, we will show you how to use TaskWeaver to forecast QQQ's price in the next 7 days. \n\n[Nasdaq 100 Index Price Forecasting](https://github.com/microsoft/TaskWeaver/assets/7489260/1361ed83-16c3-4056-98fc-e0496ecab015)\n\nIf you want to follow this example, you need to ensure you have these two requirements installed:\n```bash\npip install yfinance\npip install statsmodels\n```\n\nFor more examples, please refer to our [paper](http://export.arxiv.org/abs/2311.17541). \n\n\u003e 💡 The planning of TaskWeaver are based on the LLM model. Therefore, if you want to repeat the examples, the execution process may be different\n\u003e from what you see in the videos. For example, in the second demo, the assistant may ask the user which prediction algorithm should be used.\n\u003e Typically, more concrete prompts will help the model to generate better plans and code.\n\n\n## 📚 Citation\nOur paper could be found [here](http://export.arxiv.org/abs/2311.17541). \nIf you use TaskWeaver in your research, please cite our paper:\n```\n@article{taskweaver,\n  title={TaskWeaver: A Code-First Agent Framework},\n  author={Bo Qiao, Liqun Li, Xu Zhang, Shilin He, Yu Kang, Chaoyun Zhang, Fangkai Yang, Hang Dong, Jue Zhang, Lu Wang, Minghua Ma, Pu Zhao, Si Qin, Xiaoting Qin, Chao Du, Yong Xu, Qingwei Lin, Saravan Rajmohan, Dongmei Zhang},\n  journal={arXiv preprint arXiv:2311.17541},\n  year={2023}\n}\n```\n\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft \ntrademarks or logos is subject to and must follow \n[Microsoft's Trademark \u0026 Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n\n## Disclaimer\nThe recommended models in this Repo are just examples, used to explore the potential of agent systems with the paper at [TaskWeaver: A Code-First Agent Framework](https://export.arxiv.org/abs/2311.17541). Users can replace the models in this Repo according to their needs. When using the recommended models in this Repo, you need to comply with the licenses of these models respectively. Microsoft shall not be held liable for any infringement of third-party rights resulting from your usage of this repo. Users agree to defend, indemnify and hold Microsoft harmless from and against all damages, costs, and attorneys' fees in connection with any claims arising from this Repo. If anyone believes that this Repo infringes on your rights, please notify the project owner email.\n","funding_links":[],"categories":["Python","**Section 2** : Azure OpenAI and Reference Architecture","others","Software Development","A01_文本生成_文本对话","Frameworks","🤖 ChatGPT Agents","其他LLM框架","Repos","Other LLM Frameworks","🚀 AI Tools for Vim, Neovim, and Terminal","Agent Frameworks","🕵️ 智能体（Agents）","🤖 Agent Frameworks \u0026 Multi-Agent Systems","AI Agent Frameworks \u0026 SDKs","🚀 Specialized Agents","Table of Open-Source AI Agents Projects","Agent Frameworks (fully local) (25)","Agent Categories"],"sub_categories":["**Microsoft Azure OpenAI relevant LLM Framework**","大语言对话模型及数据","Advanced Components","Business \u0026 Productivity","文章","Videos Playlists","主流 Agent 框架","**Advanced Agent Orchestration**","Orchestration Frameworks","💻 Coding Agents","\u003ca name=\"Unclassified\"\u003e\u003c/a\u003eUnclassified"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2FTaskWeaver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2FTaskWeaver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2FTaskWeaver/lists"}