Building Sub‑Agents for a Desktop AI Companion
Описание и применение
Создание суб‑агентов для настольного AI‑компаньона Ankita позволяет изолировать задачи, ограничивать контекст и возвращать компактные отчёты, тем самым предотвращая рост истории и блокировки при выполнении нескольких задач одновременно.
Задача
A single AI agent on a desktop can only handle one conversation at a time, causing context ballooning and blocking when it tries to perform multiple independent tasks.
Результат
Sub‑agents keep the parent’s context small, enforce isolation, and provide a clear, capped report for each task, improving reliability and auditability.
Рабочий процесс
- 1. Parent agent receives a user request.
- 2. Parent calls
delegate_taskwith a brief and a sub‑agent type (explore, reviewer, or worker). - 3. Sub‑agent runs its own tool loop with a depth of 1 and bounded budgets.
- 4. Sub‑agent produces a capped envelope (status, summary, final answer, tools, token usage, duration, transcript path).
- 5. Parent receives the envelope, verifies the report, and updates its state.
- 6. Parent repeats for subsequent requests, serializing workers per workspace path to avoid conflicts.
Доказательства
Sooner or later, any agent like that hits the same wall: one conversation trying to do three independent jobs at once. The parent's context balloons, the work interleaves, and a long task blocks everything behind it.
A child in Ankita sees only its brief — the prompt passed to delegate_task. It cannot ask questions and cannot delegate.
When it finishes, the parent receives one result envelope: status, a summary capped at 2,000 bytes, the full final answer capped at 48,000 bytes by default, the tools used, token usage, duration, and a transcript path.
There are exactly three child types, defined in src/core/subagents/registry.mjs…
Workers are the opposite: a mutation barrier. One worker runs at a time across the whole process, keyed by the canonical workspace path…
- Дата записи: 2026-11-01T20:44:15.033Z