description: "Shared service mounting for tests that exercise the concrete AgentLoop, for test authors wiring real loop prerequisites."
English | 中文
dsh-agent-loop-testkit mounts the standard prerequisite services a test needs before loading the concrete AgentLoop — the LLM runtime, session store, system-prompt registry, tool registry, and agent registry — in dependency order, with one call. The loop itself, adapters, optional plugins, agents, and teardown stay in the test's hands, so each scenario keeps its own load order and topology. Use it when a test's subject is loop behavior rather than service wiring; tests that probe injection failures or partial topologies mount their dependencies directly. It registers no model-facing behavior of its own.
This package gives an AgentLoop test a working service topology before the loop is mounted: call the helper on your test context, then mount AgentLoop with the configuration under test and register your adapter and optional plugins.
import { Context } from '@deepseek-ai/cordis'
import AgentLoop from '@deepseek-ai/dsh-agent-loop'
import { mountAgentLoopTestDependencies } from '@deepseek-ai/dsh-agent-loop-testkit'
const ctx = new Context()
await mountAgentLoopTestDependencies(ctx)
// Register the test adapter and any optional plugins here.
await ctx.plugin(AgentLoop, { agents: [] })
The helper activates the LLM, session, system-prompt, tool, and agent services in dependency order and returns before the loop is mounted. System-prompt and tool-registry configuration can be forwarded through options; the helper provides no test defaults beyond those the services own.
Use the helper for tests whose subject is the loop: load order, retries, tool execution, or session behavior on a real prerequisite stack. Mount dependencies directly when a test probes service load order, injection failures, partial topologies, or teardown — the helper hides exactly the wiring such tests must control.
A plugin-load failure rejects the helper call; services activated earlier in the sequence remain owned by your context and unwind with it. The context owns every mounted service, so dispose it after the test.
Read these pages when the package-level contract is not enough. They move from the loop to the services the helper mounts and the tests that use it.
None, as this test-only composition helper neither drives nor modifies model requests.
None; this package neither assembles nor sends a provider request.
These limits define what the helper does not share. They are current package constraints, not a task backlog.
AgentLoop, agents, and context teardown remain caller-owned so scenario-specific ordering stays visible.