Metadata-Version: 2.4
Name: agentica
Version: 1.4.13
Summary: Agentica: A lightweight Python SDK for building AI agents with persistent memory and self-evolution
Author-email: XuMing <xuming624@qq.com>
License:                                  Apache License
                                   Version 2.0, January 2004
                                http://www.apache.org/licenses/
        
           TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
        
           1. Definitions.
        
              "License" shall mean the terms and conditions for use, reproduction,
              and distribution as defined by Sections 1 through 9 of this document.
        
              "Licensor" shall mean the copyright owner or entity authorized by
              the copyright owner that is granting the License.
        
              "Legal Entity" shall mean the union of the acting entity and all
              other entities that control, are controlled by, or are under common
              control with that entity. For the purposes of this definition,
              "control" means (i) the power, direct or indirect, to cause the
              direction or management of such entity, whether by contract or
              otherwise, or (ii) ownership of fifty percent (50%) or more of the
              outstanding shares, or (iii) beneficial ownership of such entity.
        
              "You" (or "Your") shall mean an individual or Legal Entity
              exercising permissions granted by this License.
        
              "Source" form shall mean the preferred form for making modifications,
              including but not limited to software source code, documentation
              source, and configuration files.
        
              "Object" form shall mean any form resulting from mechanical
              transformation or translation of a Source form, including but
              not limited to compiled object code, generated documentation,
              and conversions to other media types.
        
              "Work" shall mean the work of authorship, whether in Source or
              Object form, made available under the License, as indicated by a
              copyright notice that is included in or attached to the work
              (an example is provided in the Appendix below).
        
              "Derivative Works" shall mean any work, whether in Source or Object
              form, that is based on (or derived from) the Work and for which the
              editorial revisions, annotations, elaborations, or other modifications
              represent, as a whole, an original work of authorship. For the purposes
              of this License, Derivative Works shall not include works that remain
              separable from, or merely link (or bind by name) to the interfaces of,
              the Work and Derivative Works thereof.
        
              "Contribution" shall mean any work of authorship, including
              the original version of the Work and any modifications or additions
              to that Work or Derivative Works thereof, that is intentionally
              submitted to Licensor for inclusion in the Work by the copyright owner
              or by an individual or Legal Entity authorized to submit on behalf of
              the copyright owner. For the purposes of this definition, "submitted"
              means any form of electronic, verbal, or written communication sent
              to the Licensor or its representatives, including but not limited to
              communication on electronic mailing lists, source code control systems,
              and issue tracking systems that are managed by, or on behalf of, the
              Licensor for the purpose of discussing and improving the Work, but
              excluding communication that is conspicuously marked or otherwise
              designated in writing by the copyright owner as "Not a Contribution."
        
              "Contributor" shall mean Licensor and any individual or Legal Entity
              on behalf of whom a Contribution has been received by Licensor and
              subsequently incorporated within the Work.
        
           2. Grant of Copyright License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              copyright license to reproduce, prepare Derivative Works of,
              publicly display, publicly perform, sublicense, and distribute the
              Work and such Derivative Works in Source or Object form.
        
           3. Grant of Patent License. Subject to the terms and conditions of
              this License, each Contributor hereby grants to You a perpetual,
              worldwide, non-exclusive, no-charge, royalty-free, irrevocable
              (except as stated in this section) patent license to make, have made,
              use, offer to sell, sell, import, and otherwise transfer the Work,
              where such license applies only to those patent claims licensable
              by such Contributor that are necessarily infringed by their
              Contribution(s) alone or by combination of their Contribution(s)
              with the Work to which such Contribution(s) was submitted. If You
              institute patent litigation against any entity (including a
              cross-claim or counterclaim in a lawsuit) alleging that the Work
              or a Contribution incorporated within the Work constitutes direct
              or contributory patent infringement, then any patent licenses
              granted to You under this License for that Work shall terminate
              as of the date such litigation is filed.
        
           4. Redistribution. You may reproduce and distribute copies of the
              Work or Derivative Works thereof in any medium, with or without
              modifications, and in Source or Object form, provided that You
              meet the following conditions:
        
              (a) You must give any other recipients of the Work or
                  Derivative Works a copy of this License; and
        
              (b) You must cause any modified files to carry prominent notices
                  stating that You changed the files; and
        
              (c) You must retain, in the Source form of any Derivative Works
                  that You distribute, all copyright, patent, trademark, and
                  attribution notices from the Source form of the Work,
                  excluding those notices that do not pertain to any part of
                  the Derivative Works; and
        
              (d) If the Work includes a "NOTICE" text file as part of its
                  distribution, then any Derivative Works that You distribute must
                  include a readable copy of the attribution notices contained
                  within such NOTICE file, excluding those notices that do not
                  pertain to any part of the Derivative Works, in at least one
                  of the following places: within a NOTICE text file distributed
                  as part of the Derivative Works; within the Source form or
                  documentation, if provided along with the Derivative Works; or,
                  within a display generated by the Derivative Works, if and
                  wherever such third-party notices normally appear. The contents
                  of the NOTICE file are for informational purposes only and
                  do not modify the License. You may add Your own attribution
                  notices within Derivative Works that You distribute, alongside
                  or as an addendum to the NOTICE text from the Work, provided
                  that such additional attribution notices cannot be construed
                  as modifying the License.
        
              You may add Your own copyright statement to Your modifications and
              may provide additional or different license terms and conditions
              for use, reproduction, or distribution of Your modifications, or
              for any such Derivative Works as a whole, provided Your use,
              reproduction, and distribution of the Work otherwise complies with
              the conditions stated in this License.
        
           5. Submission of Contributions. Unless You explicitly state otherwise,
              any Contribution intentionally submitted for inclusion in the Work
              by You to the Licensor shall be under the terms and conditions of
              this License, without any additional terms or conditions.
              Notwithstanding the above, nothing herein shall supersede or modify
              the terms of any separate license agreement you may have executed
              with Licensor regarding such Contributions.
        
           6. Trademarks. This License does not grant permission to use the trade
              names, trademarks, service marks, or product names of the Licensor,
              except as required for reasonable and customary use in describing the
              origin of the Work and reproducing the content of the NOTICE file.
        
           7. Disclaimer of Warranty. Unless required by applicable law or
              agreed to in writing, Licensor provides the Work (and each
              Contributor provides its Contributions) on an "AS IS" BASIS,
              WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
              implied, including, without limitation, any warranties or conditions
              of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
              PARTICULAR PURPOSE. You are solely responsible for determining the
              appropriateness of using or redistributing the Work and assume any
              risks associated with Your exercise of permissions under this License.
        
           8. Limitation of Liability. In no event and under no legal theory,
              whether in tort (including negligence), contract, or otherwise,
              unless required by applicable law (such as deliberate and grossly
              negligent acts) or agreed to in writing, shall any Contributor be
              liable to You for damages, including any direct, indirect, special,
              incidental, or consequential damages of any character arising as a
              result of this License or out of the use or inability to use the
              Work (including but not limited to damages for loss of goodwill,
              work stoppage, computer failure or malfunction, or any and all
              other commercial damages or losses), even if such Contributor
              has been advised of the possibility of such damages.
        
           9. Accepting Warranty or Additional Liability. While redistributing
              the Work or Derivative Works thereof, You may choose to offer,
              and charge a fee for, acceptance of support, warranty, indemnity,
              or other liability obligations and/or rights consistent with this
              License. However, in accepting such obligations, You may act only
              on Your own behalf and on Your sole responsibility, not on behalf
              of any other Contributor, and only if You agree to indemnify,
              defend, and hold each Contributor harmless for any liability
              incurred by, or claims asserted against, such Contributor by reason
              of your accepting any such warranty or additional liability.
        
           END OF TERMS AND CONDITIONS
        
           APPENDIX: How to apply the Apache License to your work.
        
              To apply the Apache License to your work, attach the following
              boilerplate notice, with the fields enclosed by brackets "[]"
              replaced with your own identifying information. (Don't include
              the brackets!)  The text should be enclosed in the appropriate
              comment syntax for the file format. We also recommend that a
              file or class name and description of purpose be included on the
              same "printed page" as the copyright notice for easier
              identification within third-party archives.
        
           Copyright [yyyy] [name of copyright owner]
        
           Licensed under the Apache License, Version 2.0 (the "License");
           you may not use this file except in compliance with the License.
           You may obtain a copy of the License at
        
               http://www.apache.org/licenses/LICENSE-2.0
        
           Unless required by applicable law or agreed to in writing, software
           distributed under the License is distributed on an "AS IS" BASIS,
           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
           See the License for the specific language governing permissions and
           limitations under the License.
        
Project-URL: Homepage, https://github.com/shibing624/agentica
Project-URL: Documentation, https://shibing624.github.io/agentica
Project-URL: Repository, https://github.com/shibing624/agentica
Project-URL: Issues, https://github.com/shibing624/agentica/issues
Project-URL: Changelog, https://github.com/shibing624/agentica/blob/main/CHANGELOG.md
Keywords: ai,agent,llm,sdk,agentic
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: openai>=2.51.0
Requires-Dist: anthropic>=0.40
Requires-Dist: pydantic>=2.0
Requires-Dist: httpx>=0.26
Requires-Dist: Pillow>=10.0
Requires-Dist: aiofiles>=23.0
Requires-Dist: tiktoken>=0.5
Requires-Dist: pyyaml>=6.0
Requires-Dist: ruamel.yaml>=0.17
Requires-Dist: python-dotenv>=1.0
Requires-Dist: typing_extensions>=4.0
Requires-Dist: python-frontmatter>=1.0
Requires-Dist: prompt-toolkit>=3.0
Requires-Dist: rich>=13.0
Requires-Dist: beautifulsoup4>=4.12
Requires-Dist: lxml>=4.9
Requires-Dist: markdownify>=0.11
Requires-Dist: requests>=2.31
Requires-Dist: puremagic>=1.15
Requires-Dist: tqdm>=4.65
Provides-Extra: ollama
Requires-Dist: ollama>=0.1; extra == "ollama"
Provides-Extra: azure
Requires-Dist: azure-ai-inference>=1.0; extra == "azure"
Requires-Dist: aiohttp; extra == "azure"
Provides-Extra: litellm
Requires-Dist: litellm<=1.82.6; extra == "litellm"
Provides-Extra: google
Requires-Dist: google-genai>=1.0; extra == "google"
Provides-Extra: groq
Requires-Dist: groq>=0.4; extra == "groq"
Provides-Extra: mistral
Requires-Dist: mistralai>=1.0; extra == "mistral"
Provides-Extra: cohere
Requires-Dist: cohere>=5.0; extra == "cohere"
Provides-Extra: bedrock
Requires-Dist: boto3; extra == "bedrock"
Requires-Dist: aioboto3; extra == "bedrock"
Provides-Extra: mcp
Requires-Dist: mcp>=1.9; extra == "mcp"
Provides-Extra: acp
Requires-Dist: websockets>=12.0; extra == "acp"
Provides-Extra: rag
Requires-Dist: scikit-learn>=1.3; extra == "rag"
Requires-Dist: numpy>=1.24; extra == "rag"
Provides-Extra: chroma
Requires-Dist: chromadb>=0.4; extra == "chroma"
Provides-Extra: lancedb
Requires-Dist: lancedb>=0.26.0; extra == "lancedb"
Requires-Dist: tantivy; extra == "lancedb"
Provides-Extra: qdrant
Requires-Dist: qdrant-client>=1.7; extra == "qdrant"
Provides-Extra: pgvector
Requires-Dist: pgvector>=0.2; extra == "pgvector"
Requires-Dist: psycopg[binary]>=3.1; extra == "pgvector"
Provides-Extra: pinecone
Requires-Dist: pinecone>=5.0; extra == "pinecone"
Provides-Extra: milvus
Requires-Dist: pymilvus>=2.5; extra == "milvus"
Provides-Extra: weaviate
Requires-Dist: weaviate-client>=4.0; extra == "weaviate"
Provides-Extra: huggingface
Requires-Dist: huggingface-hub>=0.20; extra == "huggingface"
Requires-Dist: sentence-transformers>=2.0; extra == "huggingface"
Provides-Extra: ddg
Provides-Extra: wikipedia
Requires-Dist: wikipedia>=1.4; extra == "wikipedia"
Provides-Extra: serper
Provides-Extra: exa
Provides-Extra: bocha
Provides-Extra: tavily
Requires-Dist: tavily-python>=0.3; extra == "tavily"
Provides-Extra: yfinance
Requires-Dist: yfinance>=0.2; extra == "yfinance"
Provides-Extra: arxiv
Requires-Dist: arxiv>=2.0; extra == "arxiv"
Provides-Extra: newspaper
Requires-Dist: newspaper4k; extra == "newspaper"
Requires-Dist: lxml_html_clean; extra == "newspaper"
Provides-Extra: dblp
Provides-Extra: dalle
Provides-Extra: cogview
Provides-Extra: cogvideo
Provides-Extra: ocr
Requires-Dist: pytesseract>=0.3; extra == "ocr"
Provides-Extra: image-analysis
Provides-Extra: video-analysis
Provides-Extra: browser
Requires-Dist: playwright>=1.40; extra == "browser"
Provides-Extra: crawl
Provides-Extra: jupyter
Requires-Dist: jupyter>=1.0; extra == "jupyter"
Requires-Dist: ipykernel>=6.0; extra == "jupyter"
Provides-Extra: sql
Requires-Dist: sqlalchemy>=2.0; extra == "sql"
Provides-Extra: e2b
Requires-Dist: e2b_code_interpreter>=1.0; extra == "e2b"
Provides-Extra: resend
Requires-Dist: resend>=0.7; extra == "resend"
Provides-Extra: volc-tts
Provides-Extra: weather
Requires-Dist: requests>=2.31; extra == "weather"
Provides-Extra: tools-search
Requires-Dist: agentica[ddg]; extra == "tools-search"
Requires-Dist: agentica[wikipedia]; extra == "tools-search"
Requires-Dist: agentica[serper]; extra == "tools-search"
Requires-Dist: agentica[exa]; extra == "tools-search"
Requires-Dist: agentica[bocha]; extra == "tools-search"
Provides-Extra: tools-research
Requires-Dist: agentica[arxiv]; extra == "tools-research"
Requires-Dist: agentica[wikipedia]; extra == "tools-research"
Requires-Dist: agentica[newspaper]; extra == "tools-research"
Requires-Dist: agentica[dblp]; extra == "tools-research"
Provides-Extra: tools-finance
Requires-Dist: agentica[yfinance]; extra == "tools-finance"
Provides-Extra: tools-media
Requires-Dist: agentica[dalle]; extra == "tools-media"
Requires-Dist: agentica[cogview]; extra == "tools-media"
Requires-Dist: agentica[cogvideo]; extra == "tools-media"
Requires-Dist: agentica[ocr]; extra == "tools-media"
Requires-Dist: agentica[image-analysis]; extra == "tools-media"
Requires-Dist: agentica[video-analysis]; extra == "tools-media"
Provides-Extra: tools-browser
Requires-Dist: agentica[browser]; extra == "tools-browser"
Requires-Dist: agentica[crawl]; extra == "tools-browser"
Provides-Extra: tools-extra
Requires-Dist: agentica[tools-search]; extra == "tools-extra"
Requires-Dist: agentica[tools-research]; extra == "tools-extra"
Requires-Dist: agentica[tools-finance]; extra == "tools-extra"
Requires-Dist: agentica[crawl]; extra == "tools-extra"
Provides-Extra: vectordbs
Requires-Dist: agentica[chroma]; extra == "vectordbs"
Requires-Dist: agentica[lancedb]; extra == "vectordbs"
Requires-Dist: agentica[qdrant]; extra == "vectordbs"
Requires-Dist: agentica[pgvector]; extra == "vectordbs"
Provides-Extra: postgres
Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
Requires-Dist: sqlalchemy>=2.0; extra == "postgres"
Provides-Extra: mysql
Requires-Dist: pymysql>=1.1; extra == "mysql"
Requires-Dist: sqlalchemy>=2.0; extra == "mysql"
Provides-Extra: redis
Requires-Dist: redis>=5.0; extra == "redis"
Provides-Extra: mongo
Requires-Dist: pymongo>=4.6; extra == "mongo"
Provides-Extra: storage
Requires-Dist: agentica[sql]; extra == "storage"
Requires-Dist: agentica[postgres]; extra == "storage"
Requires-Dist: agentica[mysql]; extra == "storage"
Requires-Dist: agentica[redis]; extra == "storage"
Provides-Extra: gateway
Requires-Dist: fastapi[standard]>=0.109; extra == "gateway"
Requires-Dist: uvicorn[standard]>=0.27; extra == "gateway"
Requires-Dist: websockets>=12.0; extra == "gateway"
Requires-Dist: lark-oapi>=1.0; extra == "gateway"
Requires-Dist: apscheduler>=3.10; extra == "gateway"
Requires-Dist: croniter>=1.3; extra == "gateway"
Provides-Extra: telegram
Requires-Dist: agentica[gateway]; extra == "telegram"
Requires-Dist: python-telegram-bot>=20.0; extra == "telegram"
Provides-Extra: discord
Requires-Dist: agentica[gateway]; extra == "discord"
Requires-Dist: discord.py>=2.0; extra == "discord"
Provides-Extra: slack
Requires-Dist: agentica[gateway]; extra == "slack"
Requires-Dist: slack_sdk>=3.40; extra == "slack"
Requires-Dist: websocket-client>=1.6; extra == "slack"
Provides-Extra: qq
Requires-Dist: agentica[gateway]; extra == "qq"
Requires-Dist: qq-botpy>=1.0; extra == "qq"
Provides-Extra: wecom
Requires-Dist: agentica[gateway]; extra == "wecom"
Requires-Dist: wecom_aibot_sdk>=0.1; extra == "wecom"
Provides-Extra: dingtalk
Requires-Dist: agentica[gateway]; extra == "dingtalk"
Requires-Dist: dingtalk-stream>=0.20; extra == "dingtalk"
Provides-Extra: wechat
Requires-Dist: agentica[gateway]; extra == "wechat"
Requires-Dist: qrcode>=7.0; extra == "wechat"
Requires-Dist: requests>=2.28; extra == "wechat"
Requires-Dist: pycryptodome>=3.20; extra == "wechat"
Requires-Dist: Pillow>=10.0; extra == "wechat"
Requires-Dist: graiax-silkcoder; extra == "wechat"
Provides-Extra: langfuse
Requires-Dist: langfuse>=2.0; extra == "langfuse"
Provides-Extra: opentelemetry
Requires-Dist: opentelemetry-sdk; extra == "opentelemetry"
Requires-Dist: opentelemetry-exporter-otlp; extra == "opentelemetry"
Provides-Extra: tracing
Requires-Dist: agentica[langfuse]; extra == "tracing"
Requires-Dist: agentica[opentelemetry]; extra == "tracing"
Provides-Extra: models
Requires-Dist: agentica[ollama]; extra == "models"
Requires-Dist: agentica[azure]; extra == "models"
Requires-Dist: agentica[litellm]; extra == "models"
Requires-Dist: agentica[google]; extra == "models"
Requires-Dist: agentica[groq]; extra == "models"
Requires-Dist: agentica[mistral]; extra == "models"
Requires-Dist: agentica[cohere]; extra == "models"
Provides-Extra: full
Requires-Dist: agentica[models]; extra == "full"
Requires-Dist: agentica[mcp]; extra == "full"
Requires-Dist: agentica[acp]; extra == "full"
Requires-Dist: agentica[rag]; extra == "full"
Requires-Dist: agentica[vectordbs]; extra == "full"
Requires-Dist: agentica[storage]; extra == "full"
Requires-Dist: agentica[tools-extra]; extra == "full"
Requires-Dist: agentica[tools-browser]; extra == "full"
Requires-Dist: agentica[tools-media]; extra == "full"
Requires-Dist: agentica[gateway]; extra == "full"
Requires-Dist: agentica[tracing]; extra == "full"
Requires-Dist: agentica[huggingface]; extra == "full"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: pytest-mock>=3.10; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"
Requires-Dist: mypy>=1.7; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <a href="https://github.com/shibing624/agentica">
    <img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/assets/logo.png" height="150" alt="Agentica Logo">
  </a>
</p>

<h1 align="center">Agentica</h1>

<p align="center"><b>一个人，一支 agent 团队。</b><br />CLI 终端、本机 Web、Desktop App 是同一套产品，跑在你自己的机器上。</p>

<h3 align="center"><a href="#桌面版">⬇️ 下载桌面版</a></h3>

<p align="center">macOS · Windows · Linux</p>

<p align="center">
  <a href="https://badge.fury.io/py/agentica"><img src="https://badge.fury.io/py/agentica.svg" alt="PyPI version" /></a>
  <a href="https://github.com/shibing624/agentica"><img src="https://img.shields.io/github/stars/shibing624/agentica?style=social" alt="GitHub stars" /></a>
  <a href="https://github.com/shibing624/agentica/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License Apache 2.0" /></a>
  <a href="https://github.com/shibing624/agentica/blob/main/requirements.txt"><img src="https://img.shields.io/badge/Python-3.10%2B-green.svg" alt="Python 3.10+" /></a>
  <a href="#社区与支持"><img src="https://img.shields.io/badge/wechat-group-green.svg?logo=wechat" alt="Wechat Group" /></a>
</p>

<p align="center">简体中文 | <a href="https://github.com/shibing624/agentica/blob/main/README_EN.md">English</a></p>

## 为什么选 Agentica

### 1. 🏆 同一个模型，更少的时间和 token

工具面刻意收窄、接口保持底层，对 DeepSeek 等开放模型深度适配。和 OpenAI Codex 各跑同一个模型、同一批公开题目，正面对比：

<p align="center">
  <img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/assets/benchmark-agentica-vs-codex.png" width="920" alt="Benchmark: Agentica 在 coding 与 data analysis 两个公开题库上准确率不低于 Codex，墙钟和输入 token 都少一截" />
</p>

**编程题全对、数据分析题准确率更高——而且快一倍、输入 token 少三分之二。** 复现命令、逐项指标与原始 `predictions.jsonl` 见 [评测页](https://shibing624.github.io/agentica/guides/benchmark)。

### 2. 🤝 一个会话是一个 agent，多个会话是一支队伍

一个终端会话就是一个可协作的 agent。进程内 `task` 拉临时 subagent，进程级 `delegate` 另起一整个 agent 去干独立的大活，跨终端 peer 消息让两个会话互相说话——都不需要额外部署任何东西。

### 3. 🧬 自进化，越用越强

跑完的经验自动编译成可跨会话复用的 `SKILL.md`；下次遇到同类任务，agent 读的是自己上次的结论，不是从零开始。流程见 [Skills 文档](https://shibing624.github.io/agentica/advanced/skills)。

### 4. 📱 人可以离开现场

微信 / 企微 / 飞书 / Telegram 直连本机 agent：`@会话名` 自己寻址，或者只说一句人话，让网关 agent 去指挥这台机器上的所有会话。

## 安装

```bash
pip install -U agentica
```

### 桌面版

窗口里就是同一套 Web UI，同一 `~/.agentica`，和 CLI / 浏览器混用没有区别。

> [!IMPORTANT]
> 桌面版是个壳，服务端仍是 Python 的 gateway。装应用之前先装它：
> `pip install -U "agentica[gateway]"`（同一台机器、能在终端里跑起来即可）。

| 系统 | 安装包 |
|---|---|
| **macOS** 11+ | [Apple 芯片（arm64）](https://github.com/shibing624/agentica/releases/latest/download/agentica-desktop-darwin-arm64.dmg) · [Intel（x64）](https://github.com/shibing624/agentica/releases/latest/download/agentica-desktop-darwin-x64.dmg) |
| **Windows** 10+ | [x64 安装程序（NSIS）](https://github.com/shibing624/agentica/releases/latest/download/agentica-desktop-win32-x64.exe) |
| **Linux** x64 | [AppImage（免安装）](https://github.com/shibing624/agentica/releases/latest/download/agentica-desktop-linux-x86_64.AppImage) · [deb](https://github.com/shibing624/agentica/releases/latest/download/agentica-desktop-linux-amd64.deb) |

也都附在每个 [GitHub Release](https://github.com/shibing624/agentica/releases) 里。当前构建**未签名**，系统可能拦第一次启动，按对应系统操作一次即可：

<details>
<summary><b>🍎 macOS 提示「Agentica 已损坏，无法打开」</b></summary>

macOS 给从网络下载的文件加了隔离标记，应用未签名时会被误报成「已损坏」。删掉标记即可：

1. 打开 dmg，把 `Agentica.app` 拖进「应用程序」。
2. 打开「终端」，粘贴这条命令回车（要输开机密码，输入时不显示字符）：

   ```bash
   sudo xattr -rd com.apple.quarantine /Applications/Agentica.app
   ```

</details>

<details>
<summary><b>🪟 Windows 提示「Windows 已保护你的电脑」</b></summary>

SmartScreen 会拦未签名的安装程序：点「更多信息」→「仍要运行」。只有第一次需要。

</details>

<details>
<summary><b>🐧 Linux 双击 AppImage 没反应</b></summary>

浏览器下载的 AppImage 默认没有执行权限（deb 走包管理器，没这个问题）：

```bash
chmod +x agentica-desktop-linux-x86_64.AppImage
```

</details>

也可以直接从源码跑：`cd desktop && npm install && npm start`，详见 [`desktop/README.md`](https://github.com/shibing624/agentica/blob/main/desktop/README.md)。

## 配置

配上任一模型厂商的 API Key 即可（优先级：shell 环境变量 > `.env` > `config.yaml`）：

```bash
export OPENAI_BASE_URL="https://api.openai.com/v1"
export OPENAI_API_KEY="sk-xxx"
# 或用可免费起步的智谱：export ZAI_API_KEY="your-api-key"
```

也可以写进 `~/.agentica/.env`，或运行 `agentica setup` 生成 `~/.agentica/config.yaml`（CLI 内随时 `/model` 切换）。完整说明见 [安装文档](https://shibing624.github.io/agentica/getting-started/installation)。

## 快速开始

### CLI（推荐先玩这个）

终端输入：

```bash
agentica
```

进交互终端后直接说话，例如「帮我看下这个仓库的单测为什么挂了」。

<img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/assets/cli_snap.png" width="800" alt="Agentica CLI 截图" />

### Web

```bash
pip install -U "agentica[gateway]"
agentica-gateway
```

本机网页在 `http://127.0.0.1:8881/chat`（聊天、轨迹、设置）。首次启动会建一个 `admin` 账号并把随机初始密码打在终端里。微信 / 企微 / 飞书 / Telegram 直连见 [Gateway 文档](https://github.com/shibing624/agentica/blob/main/docs/advanced/gateway.md)。

<img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/assets/agentica-web.png" width="800" alt="Agentica Web UI 截图" />

### Python SDK

让 Agent 直接搜资料 + 写文件，一行 `run_sync` 开始干活：

```python
from agentica import Agent, OpenAIChat, BuiltinWebSearchTool, BuiltinFileTool, BuiltinExecuteTool

agent = Agent(
    model=OpenAIChat(id="gpt-4o-mini"),
    tools=[BuiltinWebSearchTool(), BuiltinFileTool(work_dir="./workspace"), BuiltinExecuteTool(work_dir="./workspace")],
)
agent.run_sync("帮我搜 Python 3.13 新特性，写到 features.md")
```

开箱即用的完全体（内置工具 + 压缩 + 长期记忆 + skills + MCP）：

```python
from agentica import DeepAgent
agent = DeepAgent()
```

## 功能特性

**核心引擎**

- **Async-First** — 原生 async API，`asyncio.gather()` 并行工具执行，同步适配器兼容
- **内置工具** — 搜索、代码执行、文件操作、浏览器、OCR、图像生成
- **多模型** — OpenAI Chat Completions / [Responses API](https://shibing624.github.io/agentica/guides/openai-responses)、DeepSeek、Claude、ZhipuAI、Qwen、Moonshot、Ollama、LiteLLM 等
- **安全守卫** — 输入/输出/工具级 Guardrails，流式实时检测
- **多模态** — 文本、图像、音频、视频理解

**产品入口**

- **CLI** — `agentica` 交互终端；进程内 `task`、进程级 `delegate`、跨终端 peer 消息
- **Web** — `agentica-gateway` 本机 SPA（聊天 / 轨迹 / 设置）+ IM 渠道
- **Desktop App** — Electron 薄壳，同一套 Web，先 attach 再 spawn

**协作**

- **多智能体** — SDK：`Agent.as_tool()`、Workflow、Swarm、[Markdown Subagent](https://shibing624.github.io/agentica/multi-agent/subagent)；CLI：`task` / `delegate` / peer 消息（见 [终端文档](https://shibing624.github.io/agentica/getting-started/terminal)）
- **Actor-Critic 精炼** — `refine()` + 多 Critic 并行评审，`SchemaCritic` 程序级零成本验证 / `AgentCritic` 异构强模型把关，循环检测自动早停

**记忆与进化**

- **持久化记忆** — 索引/内容分离、相关性召回、四类型分类、drift 防御；常驻规则写在 `AGENTS.md`
- **Skill 系统** — 基于 Markdown 的技能注入，支持项目级、用户级和外部托管 skill 目录
- **自进化** — 经验卡片自动编译为可跨会话复用的 `SKILL.md`

**集成**

- **MCP / ACP** — Model Context Protocol 和 Agent Communication Protocol 支持
- **RAG** — 知识库管理、混合检索、Rerank，集成 LangChain / LlamaIndex

架构与执行引擎（Agentic Loop、两层上下文压缩、四层护栏）见 [架构文档](https://shibing624.github.io/agentica/introduction/architecture)。

## 多会话协作：`task` / `delegate` / peer

| 机制 | 做什么 | 何时用 |
|------|--------|--------|
| `task` | 同进程 subagent（默认 auxiliary 模型，只读） | 搜代码、查资料等短活 |
| `delegate` | 另起一个完整 `agentica --query --print` 进程 | 需要独立 context / 另一目录的大活；`/ps`、`wait`、`/stop` 可管 |
| peer | 两个交互终端互发纯文本（`list_agents` / `send_message`） | 告诉另一会话「这边改了什么」，不是雇工 |

选型细节：[Choosing](https://shibing624.github.io/agentica/multi-agent/choosing) · [终端文档](https://shibing624.github.io/agentica/getting-started/terminal)。

## 示例

查看 [examples/](https://github.com/shibing624/agentica/tree/main/examples) 获取完整示例，涵盖：

| 类别 | 内容 |
|------|------|
| **基础用法** | Hello World、流式输出、结构化输出、多轮对话、多模态、**Agentic Loop 对比** |
| **工具** | 自定义工具、Async 工具、搜索、代码执行、并行工具、并发安全、成本追踪、沙箱隔离、压缩 |
| **Agent 模式** | Agent 作为工具、并行执行、团队协作、辩论、路由分发、Swarm、子 Agent、模型层钩子、会话恢复 |
| **安全护栏** | 输入/输出/工具级 Guardrails、流式护栏 |
| **记忆** | 会话历史、WorkingMemory、上下文压缩、Workspace 记忆、LLM 自动记忆 |
| **RAG** | PDF 问答、高级 RAG、LangChain / LlamaIndex 集成 |
| **工作流** | 数据管道、投资研究、新闻报道、代码审查 |
| **MCP** | Stdio / SSE / HTTP 传输、JSON 配置 |
| **可观测性** | Langfuse、Token 追踪、Usage 聚合 |
| **应用** | LLM OS、深度研究、客服系统、**金融研究（6-Agent 流水线）** |

[→ 查看完整示例目录](https://github.com/shibing624/agentica/blob/main/examples/README.md)

## 和其它 Agent CLI 对比

| | Agentica | Claude Code | Codex CLI |
|---|---|---|---|
| 模型选择 | ✅ 多厂商自由切换 | 仅 Claude 模型 | 仅 OpenAI 模型 |
| 跨终端多会话协作 | ✅ peer + `delegate` / `task` | ❌ | ❌ |
| Web + Desktop + IM | ✅ 本机网页 / Desktop App / 微信企微飞书 Telegram | ❌ | ❌ |
| 自进化 Skill | ✅ 经验自动编译 `SKILL.md` | ❌ | ❌ |
| Python SDK | ✅ 完整 SDK，可嵌入任意代码 | 部分（绑定 Claude） | ❌ |
| 开源 | ✅ Apache 2.0 | ❌ | ✅ |

## 🔥 News

- [2026/08/20] **v1.4.13**：Web 换成 Vite + React SPA 并新增轨迹页；网页界面默认英文、设置里可切简体中文；新增 **Desktop App 安装包**（macOS dmg / Windows NSIS / Linux AppImage·deb）。详见 [Release-v1.4.13](https://github.com/shibing624/agentica/releases/tag/v1.4.13)
- [2026/08/10] **v1.4.12**：上下文压缩升级：三层上下文压缩收敛为两层（截断旧 tool result → LLM/native 摘要）；新增跨终端 peer 消息（`list_agents` / `send_message`）与进程级 `delegate`（独立 `agentica --query --print`，经 `/ps` `/stop` `wait` 托管），与进程内 `task` 分工明确。详见 [Release-v1.4.12](https://github.com/shibing624/agentica/releases/tag/v1.4.12)
- [2026/08/04] **v1.4.11**：新增 OpenAI Responses API（含原生 compaction）、Markdown 可配置 subagent、`apply_patch` 多文件；CLI resume/状态栏/压缩提示增强；裁减 prompt 与 grep/glob schema；修复 Learned Experiences 污染与 `write_todos` 全量回显。详见 [Release-v1.4.11](https://github.com/shibing624/agentica/releases/tag/v1.4.11)

<details>
<summary>更多版本</summary>

- [2026/07/24] **v1.4.10**：支持视觉模型原生图片输入与模型能力 catalog 路由；新增 `/rename` 和按名称 `/resume`。详见 [Release-v1.4.10](https://github.com/shibing624/agentica/releases/tag/v1.4.10)
- [2026/07/21] **v1.4.9**：内置 subagent 全部改为只读；`edit_file` 改为 tip 提示而非硬拒；修复 `ask_user_question` CLI 卡死。详见 [Release-v1.4.9](https://github.com/shibing624/agentica/releases/tag/v1.4.9)
- [2026/07/05] **v1.4.7**：CLI 新增 cron 运行时（`/cron` 命令 + daemon）、自管理（`/upgrade`、`/config set|env`）；统一配置到 `~/.agentica/config.yaml`。详见 [Release-v1.4.7](https://github.com/shibing624/agentica/releases/tag/v1.4.7)
- [2026/06/03] **v1.4.6**：支持fallback模型可配置，支持多个fallback模型；支持 LSP， CLI 开启 LSP 开关（`--enable-diagnostics`/`--diagnostics-server`）；支持 `agentica doctor`；支持 `/goal` 长程任务。详见 [Release-v1.4.6](https://github.com/shibing624/agentica/releases/tag/v1.4.6)
- [2026/05/11] **v1.4.4**：MemoryExtractHooks 优化，新增 `auto_extract_memory_background` 后台抽取（不再阻塞 `on_agent_end`），memory 抽取优先走更快更便宜的 `auxiliary_model`。详见 [Release-v1.4.4](https://github.com/shibing624/agentica/releases/tag/v1.4.4)
- [2026/05/10] **v1.4.3**：Skill 生命周期重构 + VaG 解耦，新增 `SkillLifecycleHooks` 统一扩展点。详见 [Release-v1.4.3](https://github.com/shibing624/agentica/releases/tag/v1.4.3)

</details>

## 文档

完整使用文档：**https://shibing624.github.io/agentica**

## 社区与支持

> 如果 Agentica 帮到了你，欢迎点个 ⭐ Star，让更多人看到！

- **GitHub Issues** — [提交 issue](https://github.com/shibing624/agentica/issues)
- **微信群** — 添加微信号 `xuming624`，备注 "llm"，加入技术交流群

<img src="https://raw.githubusercontent.com/shibing624/agentica/main/docs/assets/wechat.jpeg" width="200" alt="微信群二维码" />

## 引用

如果您在研究中使用了 Agentica，请引用：

> Xu, M. (2026). Agentica: A Human-Centric Framework for Large Language Model Agent Workflows. GitHub. https://github.com/shibing624/agentica

BibTeX：

```bibtex
@misc{xu2026agentica,
  author    = {Xu, Ming},
  title     = {Agentica: A Human-Centric Framework for Large Language Model Agent Workflows},
  year      = {2026},
  publisher = {GitHub},
  url       = {https://github.com/shibing624/agentica}
}
```

仓库根目录也提供了 [CITATION.cff](https://github.com/shibing624/agentica/blob/main/CITATION.cff)。

## 许可证

[Apache License 2.0](https://github.com/shibing624/agentica/blob/main/LICENSE)

## 贡献

欢迎贡献！请查看 [CONTRIBUTING.md](https://github.com/shibing624/agentica/blob/main/CONTRIBUTING.md)。

## 致谢

- [phidatahq/phidata](https://github.com/phidatahq/phidata)
- [openai/openai-agents-python](https://github.com/openai/openai-agents-python)
