DSH Toolbox

Subagents in DeepSeek Harness

A subagent is a child the parent agent starts, can continue later, and can discover afterwards. Creation ancestry, runtime ownership and communication all live on the subagent tree — not on the parent session.

Eight plugins carry this in a web profile: the core dsh-subagent, two in-process providers (dsh-subagent-spawn-in-process as spawn, dsh-subagent-fork-in-process as fork), the dsh-tool-subagent family that exposes delegation to the model, dsh-tool-subagent-control for identity and inbox, and dsh-agent-team for shared tasks. Several of them ship disabled and are enabled per profile.

Every backend goes through one activation call. The model-facing delegation tools use parent delivery — the result comes back as a message to the parent. Code and workflow consumers can use caller delivery and await the result without injecting anything.

What a child actually is

A local child is a real session with its own runtime, not a function call. It keeps the parent's original project, and a cold resume keeps the directory state that was logged for it.

A child that has ended is still listed. What changes is whether its descriptor is available: without one it stays discoverable as mode: 'unknown' and grants no continuation.

Naming: 1–32 characters, and not lead

A requested name must be 1–32 lower-case letters, digits or hyphens, start with a letter, and must not be lead — that one is reserved for the root.

Omit it and the parent gets the first free agent-N. Names are unique among one parent's children, not across the tree.

How a child is displayed

The displayed name is slash-separated from the root — reviewer/checker — but only when every creator below the root is named. If any level went unnamed, the display falls back to the child session id, which is why two children can look identical in a listing while having different identities.

Capacity counts children, not the root

running counts starting, resident and stopping children and excludes the root. limit is the configured ceiling — and it is not enforced retroactively: lower the limit after children are already running and running can sit above it until they finish.

Observing capacity reserves nothing. It is a read, not a reservation.

A preset can differ from the parent's

Not every backend supports it, but where agentPreset is available the child can run a different preset than the parent — that is a capability flag, not a global setting. The same call validates every requested option against the backend's capability flags before anything starts.

Which directory a child starts in

A host may pass an optional cwd for the child's initial directory; a relative path resolves against the parent's current directory. Omit it and the parent's directory at admission is captured.

The model-facing delegation tools pass no directory at all — so what the model "sees" as the working directory is whatever was captured, not something it chose.

What survives a resume

Continuation is a capability of the activation, not of the name. Resuming addresses the same activation; a later activation of the same child is a different object.

A child whose provider is gone still appears in the catalog. It just does not offer continuation, and nothing about that is an error.

Two events worth watching

subagent/start fires when a provider has established a published child; for in-process providers the agent is resolvable during that notification. subagent/end pairs with it.

Dispatch is keyed by the subagent tree root, so a listener registered at the root observes every activation in that tree — not just its own direct children.

Common questions

Is a subagent a separate process?

Not necessarily. The shipped providers are in-process (spawn and fork); external backends are possible through the same activation API, which is why the request carries a provider name rather than a transport.

Why does the child show up as agent-1?

Because no name was requested. Omission picks the first free agent-N for that parent. Names are per parent, so two different parents can both have an agent-1.

Does lowering the concurrency limit stop running children?

No. The limit is checked when new children start; children already running continue, and running can remain above a lowered limit until they finish.