Files
deepseek-harness/website/zh-CN/api/harness/subagents.md
2026-07-19 14:14:02 +08:00

3.1 KiB

ctx.subagents

SubagentService — provided by @deepseek-ai/dsh-subagent.

Named provider registry and capability-checked start surface.

Source

ctx.subagents.registerProvider(provider)

/**
 * Register a provider under its name. Registration is effect-scoped and HMR
 * safe; removing a provider blocks new starts but does not revoke runs that
 * were already returned to their holders.
 * @param provider - the trusted provider implementation.
 * @returns the exact Cordis effect disposer.
 */
registerProvider(provider: SubagentProvider): () => void

Register a provider under its name. Registration is effect-scoped and HMR safe; removing a provider blocks new starts but does not revoke runs that were already returned to their holders.

  • provider — the trusted provider implementation.

Returns the exact Cordis effect disposer.

Source

ctx.subagents.getProvider(name)

/**
 * Look up a provider by name.
 * @param name - the provider name.
 * @returns the provider, or undefined when absent.
 */
getProvider(name: string): SubagentProvider | undefined

Look up a provider by name.

  • name — the provider name.

Returns the provider, or undefined when absent.

Source

ctx.subagents.list()

/**
 * List registered provider names in insertion order.
 * @returns the registered names.
 */
list(): string[]

List registered provider names in insertion order.

Returns the registered names.

Source

ctx.subagents.start(name, request)

/**
 * Establish a ready child on the named provider. Capability and semantic
 * checks run before delegation. Provider ownership lasts until its promise
 * fulfills; a rejection therefore has no run for the caller to dispose and
 * emits no run lifecycle events.
 * @param name - the provider to use.
 * @param request - child prompt, parent, signal, and optional capabilities.
 * @returns the ready holder-owned run.
 */
async start(name: string, request: SubagentStartRequest): Promise<SubagentRun>

Establish a ready child on the named provider. Capability and semantic checks run before delegation. Provider ownership lasts until its promise fulfills; a rejection therefore has no run for the caller to dispose and emits no run lifecycle events.

  • name — the provider to use.
  • request — child prompt, parent, signal, and optional capabilities.

Returns the ready holder-owned run.

Source