2026-07-16 18:13:34 +08:00
<!-- Generated by scripts/gen-website-api.ts — do not edit by hand. Run `pnpm run gen-website-api` to regenerate. -->
# ctx.agentLoop
`AgentLoop` — provided by `@deepseek-ai/dsh-agent-loop` .
2026-07-18 12:33:49 +08:00
Concrete agent factory and driver service.
2026-07-16 18:13:34 +08:00
2026-07-19 01:57:18 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L407 )
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
### ctx.agentLoop.create(id, options?, meta?)
2026-07-16 18:13:34 +08:00
```ts website-api
2026-07-18 12:33:49 +08:00
create(id: SessionId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): Agent
2026-07-16 18:13:34 +08:00
` ``
2026-07-18 12:21:15 +08:00
Create an agent and session under one caller-supplied identity, owned by the accessing fiber. Constructor-driven config calls mint a fresh combined id before entering this boundary.
2026-07-16 18:13:34 +08:00
2026-07-18 12:21:15 +08:00
- ` id` — shared agent/session identity.
2026-07-16 21:36:43 +08:00
- ` options` — concrete loop options.
- ` meta` — optional fresh-session workspace metadata.
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
**Returns** the published running agent.
2026-07-16 18:13:34 +08:00
2026-07-19 01:57:18 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L542)
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
### ctx.agentLoop.createAgent(ownerCtx, options)
2026-07-16 18:13:34 +08:00
` ``ts website-api
2026-07-16 21:36:43 +08:00
async createAgent(ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle>
2026-07-16 18:13:34 +08:00
` ``
2026-07-16 21:36:43 +08:00
Create an owned agent on a caller-supplied session id.
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
- ` ownerCtx` — caller context that structurally owns the transaction.
- ` options` — identities, session seed/metadata, loop options, setup, and cancellation.
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
**Returns** the published handle.
2026-07-16 18:13:34 +08:00
2026-07-19 01:57:18 +08:00
[Source](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L564)
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
### ctx.agentLoop.resume(ownerCtx, options)
2026-07-16 18:13:34 +08:00
` ``ts website-api
2026-07-16 21:36:43 +08:00
async resume(ownerCtx: Context, options: ResumeAgentOptions): Promise<AgentHandle>
2026-07-16 18:13:34 +08:00
` ``
2026-07-16 21:36:43 +08:00
Resume an owned agent from the configured persistence service.
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
- ` ownerCtx` — caller context that owns load, setup, and the live lifecycle.
- ` options` — persisted identity, loop options, setup, and cancellation.
2026-07-16 18:13:34 +08:00
2026-07-16 21:36:43 +08:00
**Returns ** the published handle.
2026-07-16 18:13:34 +08:00
2026-07-19 01:57:18 +08:00
[Source ](https://github.com/deepseek-harness/deepseek-harness/blob/master/packages/core/agent-loop/src/index.ts#L596 )