Files
deepseek-harness/website/zh-CN/api/harness/agent-loop.md
Tianyi Cui 864b7bfd65 Merge remote-tracking branch 'origin/master' into feat/tui-package
# Conflicts:
#	docs/architecture.md
#	docs/config-catalog.md
#	docs/cordis-catalog/events.md
#	docs/event-producer-consumer.md
#	docs/module-graph.md
#	examples/coding-agent/cordis.yml
#	examples/echo-agent/cordis.yml
#	knip.json
#	packages/core/agent-loop/README.md
#	packages/core/agent-loop/tests/config-session-id.spec.ts
#	packages/examples/README.md
#	packages/examples/stdio-demo/README.md
#	packages/examples/stdio-demo/tests/stdio-agent.spec.ts
2026-07-18 21:20:47 +08:00

2.0 KiB

ctx.agentLoop

AgentLoop — provided by @deepseek-ai/dsh-agent-loop.

Concrete ReactLoopAgent factory and driver service.

Source

ctx.agentLoop.create(id, options?, meta?)

create(id: AgentId, options: AgentOptions = {}, meta: Pick<SessionHeader, 'cwd'> = {}): ReactLoopAgent

Create an agent on a fresh per-run session, owned by the accessing fiber. Constructor-driven config calls use the loop fiber itself.

  • id — agent registry id.
  • options — concrete loop options.
  • meta — optional fresh-session workspace metadata.

Returns the published running agent.

Source

ctx.agentLoop.createAgent(ownerCtx, options)

async createAgent(ownerCtx: Context, options: CreateAgentOptions): Promise<AgentHandle>

Create an owned agent on a caller-supplied session id.

  • ownerCtx — caller context that structurally owns the transaction.
  • options — identities, session seed/metadata, loop options, setup, and cancellation.

Returns the published handle.

Source

ctx.agentLoop.resume(ownerCtx, options)

async resume(ownerCtx: Context, options: ResumeAgentOptions): Promise<AgentHandle>

Resume an owned agent from the configured persistence service.

  • ownerCtx — caller context that owns load, setup, and the live lifecycle.
  • options — persisted identity, loop options, setup, and cancellation.

Returns the published handle.

Source