Delegation
Four delegation primitives — Delegate, SubTask, Mail, FlowTrigger — and when to use each.
Nebflow gives agents four ways to hand work to other agents. They differ in who can call them, what identity the worker gets, and how results come back.
Delegate
Spawns a sub-agent with a clean context to work on a subtask while the caller keeps going. Available to the root agent (Nebula).
- Targeting — default is a self-clone; the
agentparameter targets a standalone agent (e.g. Coder, Explorer). Cannot target team agents. - Lifecycle —
ephemeral(default): completes and exits.persistent: stays alive after completion so you can follow up via Mail. - Fork —
fork: truepasses the caller's conversation history to the sub-agent (prompt-cache reuse). - Multiple Delegate calls in one response run in parallel; results arrive as background notifications.
Best for one-off exploration and small, well-scoped changes.
SubTask
The team-member counterpart of Delegate: spawns a self-cloned, ephemeral worker for a subtask. Several SubTask calls in one response run concurrently.
- Self-clone only — no
agenttargeting, nolifecycle, nofork. The prompt is the worker's only input. - No identity — the worker is a leaf: Mail, SubTask, and Delegate are stripped from its tool set, and it is never registered as a session.
- Ephemeral — its session entry is deleted on completion; the result is delivered to the parent like a Delegate background result.
Best for splitting a task into independent, parallel parts.
Persistent-identity messaging between agents — the standard channel for ongoing collaboration.
Addressing depends on the caller's context:
| Caller | Address | Result |
|--------|---------|--------|
| Outside any team | team name (nebflow-project) | Routed to the team's lead (Manager) |
| Inside a team | member short name (backend) | Resolved within the team first |
| Anywhere | team/agent (nebflow-project/Backend) | Explicit scoped route |
Three delivery modes via the delivery parameter:
| Mode | Behavior |
|------|----------|
| immediate (default) | Async send, injected at the next turn boundary. You don't wait for a reply. |
| queue | Serialized FIFO, persisted to disk (survives restart). Processed one at a time, after the current task completes. Use for serial task chains. |
| ask | Synchronously forks the target's context and blocks for the answer. Converts to a background task after ~60s instead of failing. |
FlowTrigger
Triggers a fixed pipeline defined by a flow.json (see Flow). Availability is whitelist-driven: an agent can only trigger flows declared in its agent.json flows array (or "*"); undeclared calls are rejected.
Which One When
| Need | Use | |------|-----| | One-off exploration or small change | Delegate | | Parallel, independent subtasks | SubTask | | Ongoing collaboration between persistent agents | Mail | | Structured, repeatable multi-agent pipeline | FlowTrigger | | Long-lived project coordination with shared memory | Team (a persistent group of agents, not a delegation call) |
Common rules for Delegate and SubTask:
- The prompt must be self-contained — workers start with a clean context (no history, no team context)
- Don't spawn workers for dependent steps (B needs A's output → run serially) or trivial ones
- Don't duplicate the worker's work — split by non-overlapping files or topics