Skip to content

Commit a9170ff

Browse files
committed
update test
1 parent 9e5a6a4 commit a9170ff

40 files changed

Lines changed: 1869 additions & 309 deletions

README.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@
1616
[![GitHub issues](https://img.shields.io/github/issues/shibing624/agentica.svg)](https://github.com/shibing624/agentica/issues)
1717
[![Wechat Group](https://img.shields.io/badge/wechat-group-green.svg?logo=wechat)](#社区与支持)
1818

19-
**Agentica** 是一个轻量级 Python 框架,用于构建 AI 智能体。Async-First 架构,支持工具调用、RAG、多智能体团队、工作流编排和 MCP 协议。
19+
**Agentica** 不是套一层 LLM API 的聊天壳,而是一个 Async-First 的 agent harness。
20+
它让 Agent 能真正跑起来: 调工具、跑长任务、做多智能体协作、跨会话保留记忆,并通过 Skill system 接入可演进的 self-learn 工作流。
21+
22+
| 能力 | 说明 |
23+
|------|------|
24+
| **Long-running Agent Loop** | `Runner` 驱动的 LLM ↔ Tool 循环,内置压缩、重试、成本预算、死循环防护 |
25+
| **Works Beyond Chat** | 文件、执行、搜索、浏览器、MCP、多智能体、Workflow,不依附单一 IDE 场景 |
26+
| **Memory That Survives Sessions** | Workspace 记忆按条目存储、相关性召回,并可把确认过的偏好同步到 `~/.agentica/AGENTS.md` |
27+
| **Skill-Based Self-Learn** | SkillTool 可加载外部技能;内置 Agent 持续学习策略 |
28+
| **Open, Composable Harness** | 模型、工具、记忆、Skill、Guardrails、MCP 都是可替换部件,而不是封闭 SaaS 黑盒 |
2029

2130
## 架构
2231

@@ -76,13 +85,13 @@ export DEEPSEEK_API_KEY="your-api-key" # DeepSeek
7685
- **多智能体** — Team(动态委派)、Swarm(并行/自治)和 Workflow(确定性编排)
7786
- **安全守卫** — 输入/输出/工具级 Guardrails,流式实时检测
7887
- **MCP / ACP** — Model Context Protocol 和 Agent Communication Protocol 支持
79-
- **Skill 系统** — 基于 Markdown 的技能注入,模型无关
88+
- **Skill 系统** — 基于 Markdown 的技能注入,支持项目级、用户级和外部托管 skill 目录
8089
- **多模态** — 文本、图像、音频、视频理解
81-
- **持久化记忆** — 索引/内容分离、相关性召回、四类型分类、drift 防御
90+
- **持久化记忆** — 索引/内容分离、相关性召回、四类型分类、drift 防御,并可同步长期偏好到全局 `AGENTS.md`
8291

8392
## Workspace 记忆
8493

85-
Workspace 提供跨会话的持久化记忆,采用索引/召回设计:
94+
Workspace 提供跨会话的持久化记忆,采用索引/召回设计;需要时还可以把确认过的用户/反馈记忆编译进全局 `~/.agentica/AGENTS.md`,让新 session 自动继承
8695

8796
```python
8897
from agentica import Workspace
@@ -96,6 +105,7 @@ await workspace.write_memory_entry(
96105
content="User prefers concise, typed Python.",
97106
memory_type="feedback", # user|feedback|project|reference
98107
description="python coding style", # 相关性匹配关键词
108+
sync_to_global_agent_md=True, # 同步到 ~/.agentica/AGENTS.md 的 Learned Preferences 区块
99109
)
100110

101111
# 相关性召回(根据当前 query 返回最相关的 ≤5 条)
@@ -105,23 +115,49 @@ memory = await workspace.get_relevant_memories(query="how to write python")
105115
Agent 自动根据当前 query 召回最相关记忆,而非全量注入:
106116

107117
```python
108-
from agentica import Agent, Workspace
118+
from agentica import DeepAgent, Workspace
109119
from agentica.agent.config import WorkspaceMemoryConfig
110120

111-
agent = Agent(
121+
agent = DeepAgent(
112122
workspace=Workspace("./workspace"),
113123
long_term_memory_config=WorkspaceMemoryConfig(
114124
max_memory_entries=5, # 最多注入 5 条相关记忆
125+
sync_memories_to_global_agent_md=True,
115126
),
116127
)
117128
```
118129

130+
`DeepAgent` 默认启用 `SkillTool(auto_load=True)`,会自动发现 `~/.agentica/skills/``.agentica/skills/` 目录下的 skill;同时默认开启 `tool_config.auto_load_mcp=True`,启动时会自动读取工作目录里的 `mcp_config.json/yaml/yml`。这样 DeepAgent 开箱就是带 skills + MCP + memory 的一键完全体。
131+
119132
## CLI
120133

121134
```bash
122135
agentica --model_provider zhipuai --model_name glm-4.7-flash
123136
```
124137

138+
安装外部 skill 集合:
139+
140+
```bash
141+
agentica extensions install https://github.com/obra/superpowers
142+
```
143+
144+
如果你已经进入交互式 CLI,也可以直接在会话里安装并立刻刷新当前 skills:
145+
146+
```text
147+
> /extensions install https://github.com/obra/superpowers
148+
> /extensions list
149+
> /extensions remove learn-from-experience
150+
> /extensions reload
151+
```
152+
153+
也支持安装本地目录或指定目标目录:
154+
155+
```bash
156+
agentica extensions install /path/to/skill-repo --target-dir ~/.agentica/skills
157+
```
158+
159+
如果你安装到自定义目录而不是标准搜索路径,记得把这个目录加入 `AGENTICA_EXTRA_SKILL_PATH`,这样 `DeepAgent` 和 CLI 才会自动发现它。
160+
125161
<img src="https://github.com/shibing624/agentica/blob/main/docs/assets/cli_snap.png" width="800" />
126162

127163
## Web UI

README_EN.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@
1616
[![GitHub issues](https://img.shields.io/github/issues/shibing624/agentica.svg)](https://github.com/shibing624/agentica/issues)
1717
[![Wechat Group](https://img.shields.io/badge/wechat-group-green.svg?logo=wechat)](#community--support)
1818

19-
**Agentica** is a lightweight Python framework for building AI agents. Async-First architecture with support for tool calling, RAG, multi-agent teams, workflow orchestration, and MCP protocol.
19+
**Agentica** is not just a chat wrapper around an LLM API. It is an Async-First agent harness for running real agents:
20+
tool calling, long-running task loops, multi-agent orchestration, cross-session memory, and skill-driven self-learning workflows.
21+
22+
| Capability | What it means |
23+
|------------|---------------|
24+
| **Long-running Agent Loop** | `Runner` manages the LLM ↔ tool loop with compression, retries, cost budgets, and loop safety |
25+
| **Works Beyond Chat** | Files, execution, search, browser, MCP, multi-agent teams, and workflows instead of a single chat endpoint |
26+
| **Memory That Survives Sessions** | Workspace memory is stored as indexed entries with relevance recall, and confirmed preferences can sync into `~/.agentica/AGENTS.md` |
27+
| **Skill-Based Self-Learn** | SkillTool can load external skills, built-in agent self-learning strategy |
28+
| **Open Composable Harness** | Models, tools, memory, skills, guardrails, and MCP are replaceable building blocks instead of a closed hosted platform |
2029

2130
## Architecture
2231

@@ -76,13 +85,13 @@ export DEEPSEEK_API_KEY="your-api-key" # DeepSeek
7685
- **Multi-Agent** — Team (dynamic delegation), Swarm (parallel / autonomous), and Workflow (deterministic orchestration)
7786
- **Guardrails** — Input / output / tool-level guardrails, streaming real-time detection
7887
- **MCP / ACP** — Model Context Protocol and Agent Communication Protocol support
79-
- **Skill System** — Markdown-based skill injection, model-agnostic
88+
- **Skill System** — Markdown-based skill injection with project, user, and managed external skill directories
8089
- **Multi-Modal** — Text, image, audio, video understanding
81-
- **Persistent Memory** — Index/content separation, relevance-based recall, four-type classification, drift defense
90+
- **Persistent Memory** — Index/content separation, relevance-based recall, four-type classification, drift defense, and optional sync into global `AGENTS.md`
8291

8392
## Workspace Memory
8493

85-
Workspace provides persistent cross-session memory with index/recall design:
94+
Workspace provides persistent cross-session memory with index/recall design. When needed, confirmed user and feedback memories can also be compiled into global `~/.agentica/AGENTS.md` so new sessions inherit them automatically:
8695

8796
```python
8897
from agentica import Workspace
@@ -96,6 +105,7 @@ await workspace.write_memory_entry(
96105
content="User prefers concise, typed Python.",
97106
memory_type="feedback", # user|feedback|project|reference
98107
description="python coding style", # keywords for relevance scoring
108+
sync_to_global_agent_md=True, # sync into ~/.agentica/AGENTS.md
99109
)
100110

101111
# Relevance-based recall (returns top-k most relevant entries for the query)
@@ -105,23 +115,49 @@ memory = await workspace.get_relevant_memories(query="how to write python")
105115
Agents automatically recall the most relevant memories for the current query, rather than dumping all memory:
106116

107117
```python
108-
from agentica import Agent, Workspace
118+
from agentica import DeepAgent, Workspace
109119
from agentica.agent.config import WorkspaceMemoryConfig
110120

111-
agent = Agent(
121+
agent = DeepAgent(
112122
workspace=Workspace("./workspace"),
113123
long_term_memory_config=WorkspaceMemoryConfig(
114124
max_memory_entries=5, # inject at most 5 relevant memories
125+
sync_memories_to_global_agent_md=True,
115126
),
116127
)
117128
```
118129

130+
`DeepAgent` enables `SkillTool(auto_load=True)` by default, so it automatically discovers skills from `~/.agentica/skills/` and `.agentica/skills/`; it also turns on `tool_config.auto_load_mcp=True`, which auto-loads `mcp_config.json/yaml/yml` from the working directory when present. In practice, `DeepAgent` now boots as a one-command runtime with skills + MCP + memory already wired in.
131+
119132
## CLI
120133

121134
```bash
122135
agentica --model_provider zhipuai --model_name glm-4.7-flash
123136
```
124137

138+
Install an external skill pack:
139+
140+
```bash
141+
agentica extensions install https://github.com/obra/superpowers
142+
```
143+
144+
If you are already inside the interactive CLI, you can install and refresh skills in-place:
145+
146+
```text
147+
> /extensions install https://github.com/obra/superpowers
148+
> /extensions list
149+
> /extensions remove learn-from-experience
150+
> /extensions reload
151+
```
152+
153+
Local directories and custom targets are also supported:
154+
155+
```bash
156+
agentica extensions install /path/to/skill-repo --target-dir ~/.agentica/skills
157+
```
158+
159+
If you install into a custom directory instead of a standard search path, add that directory to `AGENTICA_EXTRA_SKILL_PATH` so `DeepAgent` and the CLI can auto-discover it.
160+
125161
<img src="https://github.com/shibing624/agentica/blob/main/docs/assets/cli_snap.png" width="800" />
126162

127163
## Web UI

agentica/agent/base.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ def _post_init(self):
310310
tool.set_parent_agent(self)
311311
elif isinstance(tool, BuiltinMemoryTool):
312312
tool.set_workspace(self.workspace)
313+
tool.set_sync_global_agent_md(
314+
self.long_term_memory_config.sync_memories_to_global_agent_md
315+
)
313316

314317
# Register BuiltinMemoryTool when memory=True and workspace exists
315318
if self.memory and self.workspace is not None:
@@ -318,6 +321,9 @@ def _post_init(self):
318321
if not has_memory_tool:
319322
memory_tool = BuiltinMemoryTool()
320323
memory_tool.set_workspace(self.workspace)
324+
memory_tool.set_sync_global_agent_md(
325+
self.long_term_memory_config.sync_memories_to_global_agent_md
326+
)
321327
if self.tools is None:
322328
self.tools = [memory_tool]
323329
else:
@@ -353,7 +359,13 @@ def _post_init(self):
353359
if self.long_term_memory_config.auto_archive:
354360
auto_hooks.append(ConversationArchiveHooks())
355361
if self.long_term_memory_config.auto_extract_memory:
356-
auto_hooks.append(MemoryExtractHooks())
362+
auto_hooks.append(
363+
MemoryExtractHooks(
364+
sync_memories_to_global_agent_md=(
365+
self.long_term_memory_config.sync_memories_to_global_agent_md
366+
)
367+
)
368+
)
357369
if auto_hooks:
358370
self._default_run_hooks = _CompositeRunHooks(auto_hooks)
359371

agentica/agent/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ class WorkspaceMemoryConfig:
111111
# Only fires when the LLM didn't call save_memory during the run.
112112
# Costs one extra LLM request per run (mirrors CC's extractMemories service).
113113
auto_extract_memory: bool = False
114+
# Recompile confirmed user/feedback memories into ~/.agentica/AGENTS.md so
115+
# future sessions automatically inherit long-lived preferences.
116+
sync_memories_to_global_agent_md: bool = False
114117

115118

116119
@dataclass

agentica/agent/deep.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class DeepAgent(Agent):
7474
- 5-stage compression pipeline (compress_tool_results=True)
7575
- Context overflow handling at 80% (context_overflow_threshold=0.8)
7676
- Repeated tool-call detection at 3 (max_repeated_tool_calls=3)
77+
- MCP auto-loading from local mcp_config.json/yaml when available
7778
- Workspace memory with relevance recall (max_memory_entries=10)
7879
- Conversation auto-archive (auto_archive=True)
7980
- Agentic prompt with datetime and agent name
@@ -160,6 +161,7 @@ def __init__(
160161

161162
if tool_config is None:
162163
tool_config = ToolConfig(
164+
auto_load_mcp=True,
163165
compress_tool_results=True,
164166
context_overflow_threshold=0.8,
165167
max_repeated_tool_calls=3,
@@ -171,6 +173,7 @@ def __init__(
171173
load_workspace_context=True,
172174
load_workspace_memory=True,
173175
max_memory_entries=10,
176+
sync_memories_to_global_agent_md=True,
174177
)
175178

176179
super().__init__(

agentica/cli/config.py

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,66 @@ def _get_tool_import_path(tool_name: str) -> str:
134134

135135

136136
def parse_args():
137-
parser = argparse.ArgumentParser(description='CLI for agentica')
138-
139137
# Check if running in ACP mode (special handling)
140138
if len(sys.argv) > 1 and sys.argv[1] == 'acp':
141139
return None # Signal to run in ACP mode
140+
141+
if len(sys.argv) > 1 and sys.argv[1] == "extensions":
142+
parser = argparse.ArgumentParser(description="Manage Agentica skill extensions")
143+
subparsers = parser.add_subparsers(dest="extensions_command", required=True)
144+
145+
install_parser = subparsers.add_parser(
146+
"install",
147+
help="Install skills from a git repository URL or local directory",
148+
)
149+
install_parser.add_argument("source", help="Git repository URL or local path")
150+
install_parser.add_argument(
151+
"--target-dir",
152+
default=None,
153+
help="Install target directory (default: ~/.agentica/skills)",
154+
)
155+
install_parser.add_argument(
156+
"--force",
157+
action="store_true",
158+
help="Replace already installed skills with the same name",
159+
)
160+
161+
list_parser = subparsers.add_parser(
162+
"list",
163+
help="List installed skills from the target directory",
164+
)
165+
list_parser.add_argument(
166+
"--target-dir",
167+
default=None,
168+
help="Skill directory to inspect (default: ~/.agentica/skills)",
169+
)
170+
171+
remove_parser = subparsers.add_parser(
172+
"remove",
173+
help="Remove an installed skill by name",
174+
)
175+
remove_parser.add_argument("skill_name", help="Installed skill directory name")
176+
remove_parser.add_argument(
177+
"--target-dir",
178+
default=None,
179+
help="Skill directory to modify (default: ~/.agentica/skills)",
180+
)
181+
182+
reload_parser = subparsers.add_parser(
183+
"reload",
184+
help="Reload skills from disk and print the current registry count",
185+
)
186+
reload_parser.add_argument(
187+
"--target-dir",
188+
default=None,
189+
help="Skill directory to inspect (default: ~/.agentica/skills)",
190+
)
191+
192+
args = parser.parse_args(sys.argv[2:])
193+
args.command = "extensions"
194+
return args
195+
196+
parser = argparse.ArgumentParser(description='CLI for agentica')
142197

143198
parser.add_argument('--query', type=str, help='Question to ask the LLM', default=None)
144199
parser.add_argument('--model_provider', type=str,

agentica/cli/display.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ def show_help():
204204
execute, web_search, fetch_url, write_todos, task
205205
- Use --tools to add extra tools, e.g.: --tools calculator shell wikipedia
206206
- Use --enable-skills to load skills, then /skills to list them
207+
- Install skill packs before launch: agentica extensions install <git-url>
208+
- Install skill packs in-session: /extensions install <git-url>
207209
- Say "remember this" or "save this" to trigger memory saving
208210
"""
209211
console.print(help_text, style="yellow")

0 commit comments

Comments
 (0)