# ctx.subagents `SubagentService` — provided by `@deepseek-ai/dsh-subagent`. The `subagents` service: a registry of named SubagentProviders and a capability-checked start surface. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L144) ### ctx.subagents.registerProvider(provider) ```ts website-api registerProvider(provider: SubagentProvider): () => void ``` Register a provider under its `provider.name`. Throws SubagentError (`DUPLICATE_PROVIDER`) if the name is already taken. Effect-scoped: disposed with the calling fiber (HMR-safe). Emits `subagent/provider-added` after the registration and `subagent/provider-removed` on unregistration, so consumers can mirror provider lifecycle instead of assuming load order. - `provider` — the provider; its `name` is the registry key. **Returns** the disposer that unregisters the provider. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L160) ### ctx.subagents.getProvider(name) ```ts website-api getProvider(name: string): SubagentProvider | undefined ``` Look up a registered provider by name (`undefined` if absent). - `name` — the provider name as registered. **Returns** the provider, or undefined when the name is unknown. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L188) ### ctx.subagents.list() ```ts website-api list(): string[] ``` The names of all registered providers (insertion order). **Returns** the registered provider names. [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L196) ### ctx.subagents.start(name, request) ```ts website-api start(name: string, request: SubagentStartRequest): SubagentRun ``` Start a subagent run on the named provider. Resolves the provider (throws `NO_PROVIDER` if absent), validates every requested START-TIME capability against SubagentProvider.capabilities (throws `UNSUPPORTED_CAPABILITY` for the first unmet one — fail loud, before any child is created), then delegates to SubagentProvider.start and emits `subagent/start` / `subagent/end` around the run. - `name` — the provider to run on. - `request` — the child's prompt, capabilities, and options. **Returns** the live run (its `result` resolves when the child settles). [Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/subagent/subagent/src/index.ts#L211)