Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Skills 是核心扩展机制,分四类,全部通过 `config.json`(OpenAI f
- Agent 的 config.json 统一使用 `prompt` 参数接收用户需求
- Agent handler 应使用 `skills/agents/runner.py` 的 `run_agent_with_tools()` 统一执行入口,它处理 prompt 加载、LLM 迭代、tool call 并发执行、结果回填
- Agent 通过 `context["ai_client"].request_model()` 调用模型,确保 Token 统计一致
- 5 个内置 Agent:info_agent, web_agent, file_analysis_agent, naga_code_analysis_agent, entertainment_agent
- 6 个内置 Agent:info_agent, web_agent, file_analysis_agent, naga_code_analysis_agent, entertainment_agent, code_delivery_agent

### Anthropic Skills (`skills/anthropic_skills/{skill_name}/SKILL.md`)
- 遵循 agentskills.io 标准,YAML frontmatter(name + description)+ Markdown 正文
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
- **会话白名单(群/私聊)**:只需配置 `access.allowed_group_ids` / `access.allowed_private_ids` 两个列表,即可把机器人“锁”在指定群与指定私聊里;避免被拉进陌生群误触发、也避免工具/定时任务把消息误发到不该去的地方(默认留空不限制)。
- **并行工具执行**:无论是主 AI 还是子 Agent,均支持 `asyncio` 并发工具调用,大幅提升多任务处理速度(如同时读取多个文件或搜索多个关键词)。
- **智能 Agent 矩阵**:内置多个专业 Agent,分工协作处理复杂任务。
- **Agent 互调用**:Agent 之间可以相互调用,通过简单的配置文件(`callable.json`)即可让某个 Agent 成为其他 Agent 的工具,支持细粒度的访问控制,实现复杂的多 Agent 协作场景。
- **Agent 自我介绍自动生成**:启动时按 Agent 代码/配置 hash 生成 `intro.generated.md`(第一人称、结构化),与 `intro.md` 合并后作为描述;减少手动维护,保持能力说明与实现同步,有助于精准调度。
- **请求上下文管理**:基于 Python `contextvars` 的统一请求上下文系统,自动 UUID 追踪,零竞态条件,完全的并发隔离。
- **定时任务系统**:支持 Crontab 语法的强大定时任务系统,可自动执行各种操作(如定时提醒、定时搜索)。
Expand Down Expand Up @@ -169,12 +170,13 @@ graph TB
TS_Scheduler["scheduler.*<br/>• create_schedule_task<br/>• delete_schedule_task<br/>• list_schedule_tasks"]
end

subgraph IntelligentAgents["智能体 Agents (5个)"]
subgraph IntelligentAgents["智能体 Agents (6个)"]
A_Info["info_agent<br/>信息查询助手<br/>(17个工具)<br/>• weather_query<br/>• *hot 热搜<br/>• bilibili_*<br/>• whois"]
A_Web["web_agent<br/>网络搜索助手<br/>• MCP Playwright<br/>• web_search<br/>• crawl_webpage"]
A_File["file_analysis_agent<br/>文件分析助手<br/>(14个工具)<br/>• extract_* (PDF/Word/Excel/PPT)<br/>• analyze_code<br/>• analyze_multimodal"]
A_Naga["naga_code_analysis_agent<br/>NagaAgent 代码分析<br/>(7个工具)<br/>• read_file / glob<br/>• search_file_content"]
A_Ent["entertainment_agent<br/>娱乐助手<br/>(9个工具)<br/>• ai_draw_one<br/>• horoscope<br/>• video_random_recommend"]
A_Code["code_delivery_agent<br/>代码交付助手<br/>(13个工具)<br/>• Docker 容器隔离<br/>• Git 仓库克隆<br/>• 代码编写验证<br/>• 打包上传"]
end

MCPRegistry["MCPToolRegistry<br/>MCP 工具注册表<br/>[mcp/registry.py]"]
Expand Down Expand Up @@ -596,6 +598,7 @@ Undefined 支持 **MCP (Model Context Protocol)** 协议,可以连接外部 MC

* **网络搜索**:"搜索一下 DeepSeek 的最新动态"
* **B站视频**:发送 B 站链接/BV 号自动下载发送视频,或指令 AI "下载这个 B 站视频 BV1xx411c7mD"
* **代码交付**:"用 Python 写一个 HTTP 服务器,监听 8080 端口,返回 Hello World,打包发到这个群"
* **定时任务**:"每天早上 8 点提醒我看新闻"

### 管理员命令
Expand Down Expand Up @@ -635,6 +638,8 @@ src/Undefined/

请参考 [src/Undefined/skills/README.md](src/Undefined/skills/README.md) 了解如何编写新的工具和 Agent。

**Agent 互调用功能**:查看 [docs/agent-calling.md](docs/agent-calling.md) 了解如何让 Agent 之间相互调用,实现复杂的多 Agent 协作场景。

### 开发自检

```bash
Expand Down
52 changes: 52 additions & 0 deletions config.toml.example
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,58 @@ auto_extract_group_ids = []
# en: Private chat allowlist for auto-extraction (empty = follow global access.allowed_private_ids).
auto_extract_private_ids = []

# zh: Code Delivery Agent 配置(代码交付 Agent,在 Docker 容器中编写代码并打包上传)。
# en: Code Delivery Agent settings (writes code in Docker containers and delivers packaged results).
[code_delivery]
# zh: 是否启用 Code Delivery Agent。
# en: Enable Code Delivery Agent.
enabled = true
# zh: 任务根目录(相对于工作目录)。
# en: Task root directory (relative to working directory).
task_root = "data/code_delivery"
# zh: Docker 镜像名称。
# en: Docker image name.
docker_image = "ubuntu:24.04"
# zh: 容器名前缀。
# en: Container name prefix.
container_name_prefix = "code_delivery_"
# zh: 容器名后缀。
# en: Container name suffix.
container_name_suffix = "_runner"
# zh: 命令默认超时时间(秒),0 表示不限时。
# en: Default command timeout (seconds), 0 means no limit.
default_command_timeout_seconds = 0
# zh: 命令输出最大字符数。
# en: Max command output characters.
max_command_output_chars = 20000
# zh: 默认归档格式(zip 或 tar.gz)。
# en: Default archive format (zip or tar.gz).
default_archive_format = "zip"
# zh: 归档文件最大大小(MB)。
# en: Max archive file size (MB).
max_archive_size_mb = 200
# zh: 任务完成后是否清理工作区和容器。
# en: Clean up workspace and container after task completion.
cleanup_on_finish = true
# zh: 启动前是否清理残留工作区和容器。
# en: Clean up leftover workspaces and containers on startup.
cleanup_on_start = true
# zh: 单次 LLM 请求最大连续失败次数(达到后发送失败通知并终止任务)。
# en: Max consecutive LLM failures per request (sends failure notification and terminates task when reached).
llm_max_retries_per_request = 5
# zh: LLM 连续失败时是否向目标发送通知。
# en: Send notification to target on consecutive LLM failures.
notify_on_llm_failure = true
# zh: 容器内存限制(如 "2g", "512m"),留空表示不限制。
# en: Container memory limit (e.g., "2g", "512m"), empty means no limit.
container_memory_limit = ""
# zh: 容器 CPU 限制(如 "2.0", "0.5"),留空表示不限制。
# en: Container CPU limit (e.g., "2.0", "0.5"), empty means no limit.
container_cpu_limit = ""
# zh: 命令黑名单(禁止执行的命令模式列表,支持通配符)。
# en: Command blacklist (list of forbidden command patterns, supports wildcards).
command_blacklist = ["rm -rf /", ":(){ :|:& };:", "mkfs.*", "dd if=/dev/zero"]

# zh: WebUI 设置。仅在使用 `Undefined-webui` 启动 WebUI 时生效;直接运行 `Undefined` 可忽略本段。
# en: WebUI settings. Only used when starting WebUI via `Undefined-webui`; ignore this section if you run `Undefined` directly.
[webui]
Expand Down
Loading