2.0 KiB
2.0 KiB
Subagents Support Plan (Flynn)
Date: 2026-02-26
Status: phase 1 implemented
Scope: add OpenClaw-style multi-turn subagent session support in Flynn without changing channel surface scope (Telegram-first)
Constraints
- Keep channel scope unchanged (Telegram remains default for now).
- Deliver subagent capability through the existing native tool loop.
- Keep gateway protocol additive-only (no new JSON-RPC methods required).
Phase 1 (Implemented in this change)
- Added subagent runtime manager (
src/backends/native/subagents.ts) that can:- spawn child sessions,
- send follow-up turns,
- list active child sessions,
- cancel in-flight child runs,
- delete child sessions.
- Added new tools:
subagent.spawnsubagent.sendsubagent.listsubagent.cancelsubagent.delete
- Wired tools into per-session router orchestration (
src/daemon/routing.ts). - Added config guardrails under
agents.subagents:enabledmax_active_sessions
- Added policy/profile support so
subagent.*is controlled throughgroup:agentsand tool profiles.
Phase 2 (Next)
- Add per-subagent TTL/idle eviction and auto-cleanup metrics.
- Add optional transcript export/summarization (
subagent.summary). - Add per-subagent tool-profile override (read-only by default for risky workloads).
- Add parent-child trace IDs in audit events for easier debugging.
Phase 3 (Stretch)
- Add queue semantics for child sessions (
followupvsinterruptper subagent). - Add explicit resource budgets (token/time) per child session.
- Add UI affordances in gateway chat for subagent session inspection.
Acceptance Criteria (Phase 1)
- Parent agent can spawn and continue a child subagent across multiple turns.
- Child session state is isolated and delete clears history.
- Recursion tooling (
agent.delegate,council.run,subagent.*) is removed from child registries. - Tests cover manager lifecycle, tool behavior, config parsing, and policy profile inclusion.