DeepSeek Harness

DeepSeek Harness: Subagent vs Main Agent

· 8 min read · 中文版

In DeepSeek Harness, a main agent can delegate a bounded task to a subagent with its own Session; the selected backend determines the child's history, while tool composition and delegated permission scope remain separate concerns.

DeepSeek Harness: How do the main agent and subagent divide work?

The parent agent owns the overall task and can delegate a separable piece to a managed child. For an in-process child, the delegation tool starts background work and returns a session ID; the child works in its own Session and the parent receives a completion notice. The child can also send a message to its parent. Programmatic callers may instead await a result directly. The subagent reference describes the shared manager and the differences between local and external backends.

Delegation is useful when a question can be stated clearly, its output can be checked, and the parent can incorporate that result. For example, a parent may ask a child to inspect one subsystem and report evidence while it examines another. The parent still needs to assess the result and resolve contradictions. A completion notice is a result of one activation, not an automatic proof of correctness.

Main agent delegates a task, child works within scope, and result returns

DeepSeek Harness: What context does a child receive?

The backend choice matters. The spawn reference describes a fresh in-process child with an empty conversation. Give it a self-contained task, relevant paths, constraints and the expected result. By default it inherits the parent's working directory and model options, subject to supported overrides; this is distinct from inheriting conversation history.

The fork reference describes a one-time seed of the parent's completed turns. The current in-flight turn is excluded, and later parent turns do not automatically flow into the child. Before any completed turn, the seed is empty. Include crucial current instructions in the delegated prompt rather than assuming the child can see them.

ChoiceInitial conversationFollow-up and result
In-process spawnFresh, empty conversationLocal Session supports later messages; parent delivery provides a notice
In-process forkCompleted parent turns at fork timeLocal Session supports later messages; in-flight and later turns are not seeded
External backendBackend-specific execution and contextThe reference describes one execution; external follow-ups are rejected

For a local child, an omitted cwd captures the parent's current effective directory at admission; a relative explicit directory resolves against that directory. The child retains the parent's original project and its own logged directory state on cold resume. These facts concern directory selection; they do not mean the directory alone confines filesystem access.

DeepSeek Harness: Do children inherit tools and permissions?

Do not equate conversation inheritance with authority. In-process spawn and fork normally join the parent's active composition when no independent preset is selected. Only spawn supports an independently selected agentPreset; actual persona and tools belong to the selected preset. The spawn package also says the child has its own registration scope and does not import the parent's agent-local tool restrictions. Inspect the effective composition rather than assuming the child's tool list is identical to the parent's.

The shared subagent package reference states that the manager captures delegated permissions at creation, and that in-process children retain the parent's origin metadata and permission roots. Its child runtime statement says the permission scope is fixed at start, cannot be widened inside the child session, and operations requiring approval are automatically rejected. When work requires more authority, the child should report the limitation to the delegating agent instead of retrying.

External providers retain their own permission systems. The subsystem explicitly warns that a backend's inheritsParentContext capability says nothing about tool registration, injected services or authority inheritance. Consequently, neither a forked transcript nor a shared process establishes identical permissions. Review the actual provider, preset and effective policy for the deployment.

DeepSeek Harness: How should you delegate and collect a result?

  1. Identify a bounded question with an observable deliverable. State what the child should investigate, what it may change, and what evidence it should return.
  2. Choose a fresh child when the prompt can stand alone. Choose a fork only when completed conversation history is useful and appropriate to share. Explicitly include current-turn facts either way.
  3. Check the selected provider and preset, working directory, available tools and permission boundary. If the task requires an operation outside the delegated scope, arrange for the parent to handle that operation rather than asking the child to widen its scope.
  4. Let the child work and use supported messaging for clarifications. The subsystem describes steering for running local children and resumption from persistence for absent continuable children; external executions reject follow-ups.
  5. Inspect the result and relevant evidence before the parent incorporates it. Completion and cleanup are distinct: the manager settles activation results after teardown and notifications, while cleanup failure is reported separately.

This division fits the agent lifecycle: each agent's work proceeds through its own turns and steps, with Session events providing durable replay facts and agent/* providing live coordination. A child is not simply another paragraph of the parent's model response.

What makes a useful delegated task?

Describe the decision the parent needs to make, not merely a broad topic. For an investigation, ask for specific evidence, relevant locations and uncertainty. For an implementation, state the allowed files or effects, expected behavior and verification. The fresh child cannot recover omitted details from the parent's conversation, and a fork does not receive the current open turn. A clear handoff also makes the returned result easier to compare with the original request.

Give each child work that can be evaluated independently. If two children might edit the same files, coordinate ownership and inspect the resulting changes before integration. A local child has a separate Session, but it can still interact with shared resources available in its effective environment. Session separation does not create separate copies of files or eliminate conflicts. The parent remains responsible for reconciling the work and checking that the overall task is complete.

How do continuation and result delivery differ?

Local children are continuable and have durable Sessions; the manager controls input admission and cold resume. External executions are one-shot in the documented model and reject follow-up messages. A parent-delivery activation provides a completion notice, while caller delivery returns the result to the caller without injecting that notice into the parent. Do not infer the same messaging behavior across providers merely because both appear in a child catalog.

The shared reference describes child membership and result collection separately from activity. A catalog entry identifies a child relationship; it is not, by itself, a current execution status. A child can have a durable record after its activation ends. When debugging a workflow, distinguish creation, current activity, completion, and cleanup instead of relying on a single label.

The general approval service also treats decisions as specific operations. Its closed outcomes include rejection, cancellation and unavailable as well as a one-time grant; callers deny when the result is not the grant. This helps explain why a child reporting an inaccessible operation is useful information rather than a request to keep retrying. The parent can assess the missing authority against the user's actual instructions and the effective environment, then decide how to proceed.

DeepSeek Harness: What are the limits and safety boundaries?

The approval reference distinguishes session policy from the subagent's delegated scope. In the general approval service, ask delegates to answerers and fails closed if unavailable; never rejects requests without dispatching answerers. Only allowed-once grants the specific operation. Do not assume an approval prompt will appear for a child whose in-process delegated scope rejects approval-requiring operations.

A child can have access to shared services and files within its effective setup. A fresh conversation is not a sandbox, and a fork may copy completed conversation content that should not be shared. Minimize the information and authority needed for the task, review outputs and changes, and verify the actual provider's constraints. Concurrency, tool availability and backend capability depend on composition; the sources do not promise that all installations expose the same delegation options. See permission presets for related concepts.

DeepSeek Harness: What do these terms mean?

  • Parent or main agent: the agent that delegates a child task and integrates the result.
  • Spawn: an in-process backend that starts a fresh child conversation.
  • Fork: an in-process backend that seeds completed parent turns at creation.
  • Preset: a composition controlling an agent's persona and tools.
  • Delegated permission scope: the child's authority captured at start; it is not identical to inherited conversation history.
  • Activation: one managed execution of a child, including its result and teardown.

Frequently asked questions

Does spawn include the parent conversation?

No. The in-process spawn backend starts a fresh conversation.

Does fork include the current turn?

No. It seeds completed parent turns at creation, excluding the in-flight turn.

Can an in-process child widen its delegated scope?

The documented child scope is fixed at start and cannot be widened from inside the session.

Sources

Every claim in this article was checked against the sources below. Community discussions are user reports, not official behavior.

  1. Subagent
  2. Agent Lifecycle
  3. Approval
  4. Readme

This is an independent community article, not official DeepSeek documentation. Listing a plugin in the registry is not a security review.

← Back to all articles

DeepSeek Harness: Subagent vs Main Agent