subagents-management

A management system for sub-agents, which are separate agents that a main agent can call for smaller tasks. They have their own configuration and cannot call another sub-agent.

In plain words
What is it for?
Use it to configure which sub-agents are available and to start, monitor, wait for, cancel, or continue delegated tasks.
Why use it?
It lets a main agent delegate short, long, or parallel tasks while keeping permissions and execution limits separate.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/xerrors/yuxi/subagents-management
Clone the repo
git clone --depth 1 https://github.com/xerrors/Yuxi
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,195 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01195
Opus 5 $0.00000 $0.00598
Sonnet 5 $0.00000 $0.00239
Haiku 4.5 $0.00000 $0.00120

Measured yesterday against content hash 5dcce19e0190, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

subagents-management scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

主智能体通过工具调用子智能体,不要通过 Shell、`curl` 或 HTTP API 间接调用。
docs/agents/subagents-management.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

使用子智能体

子智能体是一个特殊的 Agent:它仍然是 agents 表中的一级智能体,只是标记为 is_subagent=true,并使用 SubAgentBackend。因此,子智能体和普通智能体共用创建、权限和配置入口。

在页面中配置

进入“智能体”,点击“新增智能体”,在后端类型中选择 SubAgentBackend。然后像配置普通智能体一样设置名称、提示词、模型、工具、知识库、MCP 和 Skills。

子智能体有三个限制:

  • 不会出现在普通聊天的智能体切换列表中;
  • 不能设置为默认智能体;
  • 不能继续调用其他子智能体,因此不会形成孙级调用链。

主智能体在运行配置的“子智能体”字段中选择允许调用的对象:

  • 未配置或保存空列表时,使用当前用户可见的全部子智能体;
  • 显式选择后,只允许调用所选项;
  • 每个子智能体使用自己的 config_json.context,不会继承主智能体的模型或工具选择;
  • 用户权限变化后,新运行会重新计算可见范围。

调用方式

主智能体通过工具调用子智能体,不要通过 Shell、curl 或 HTTP API 间接调用。

同步任务:task

task 适合主智能体需要立即拿到结果的短任务。它会等待子智能体运行结束,再把最终文本返回给主智能体。

工具参数:

{
    "description": "整理这份文档的三条要点",
    "subagent_slug": "general-purpose",
    "thread_id": null
}

首次调用不需要 thread_id。如果要继续之前的子任务,把上一次结果中的子智能体线程 ID 传回去。

异步任务:生命周期工具

长任务或可以并行的任务使用异步工具:

工具 作用
subagent_start 创建并立即返回 run_idthread_id
subagent_status 查询运行状态和最近几条进度摘要
subagent_await 等待终态并取得最终结果;超时返回当前快照
subagent_cancel 请求取消子智能体运行

同一个子智能体线程同时只能有一个运行中的 Run。忙碌时工具返回 busy,不会隐藏地把请求排队。终态后的同一 thread_id 可以继续创建新的 Run。

所有生命周期工具按 run_id 操作,并验证该 Run 由当前父 Run 创建,不能读取或控制其他任务。

运行时边界

一次子智能体调用会创建独立的 child checkpoint thread 和 agent_runs(run_type=subagent) 记录,同时继承父运行的用户身份和根执行树:

资源 主智能体 子智能体
LangGraph checkpoint 当前 thread_id 独立 child thread_id
Sandbox runtime runtime_scope_id 与根运行相同
Project Workdir 当前 Project 的 Workdir 与根 Conversation 绑定的 Project 相同
UserWorkspace 当前用户的工作区 同一用户的工作区
共享/内置 Skills 当前用户授权的只读投影 同一授权投影

父子智能体看到的是同一份 Workdir 文件字节,不会通过 checkpoint 复制或合并文件。child thread 只隔离 LangGraph 上下文;它不是文件系统隔离边界。并发写同一路径仍按真实 POSIX 文件结果处理。

子智能体可以使用自己配置的文件工具和知识库范围,但所有资源访问仍以发起用户的后端权限为最终边界。present_artifactsask_user_questioninstall_skill 等不适合子智能体直接使用的工具会被过滤。

API 和数据模型

子智能体沿用普通 Agent 管理 API:

  • GET /api/agent 默认返回聊天可用的普通 Agent;
  • GET /api/agent?include_subagents=true 返回包含子智能体的列表;
  • 创建或更新 SubAgentBackend 时,后端会校验 is_subagent=true
  • 详情、更新和删除复用同一套 Agent 权限检查。

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 89 lines · 0 tokens per session scan A 5dcce19e0190

Subscribe to this mod's changes

subagents-management is an agent published in the GitHub repository xerrors/Yuxi (6,591 stars, last pushed yesterday), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,195 tokens. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.