Expand description
In-daemon execution of declarative agents, and the coder→agent build loop.
Two pieces:
DeclarativeAgentRunnerruns aDeclarativeAgentSpecon an input — a model→tool loop executed entirely inside the daemon, with the tool set restricted to the spec’s allowlist and policy-gated by the executor’sInspectorChain. No external process.build_agentis the coder→agent loop: it asks the model for an agent spec that satisfies the user’s intent, runs the spec’s scenarios through the runner, and repairs until every scenario passes (or it gives up) — the same generate→verify→repair shape as contract derivation, so an Agent project never touches the file-editing native loop.
Structs§
- Agent
Goal Run - Agent
RunResult - Result of one declarative-agent run.
- Build
Agent Config - Tunables for
build_agent. - Build
Agent Outcome - Outcome of the build loop.
- Build
Agent Progress Update - One progress transition from the build loop. The RPC adapter persists these in the coder session; other callers use the no-op reporter.
- Declarative
Agent Runner - Runs a declarative agent in-daemon.
- Declarative
Agent Spec - A declarative, in-daemon agent.
- Declarative
Goal - Deterministic completion contract for a declarative agent invocation.
The daemon runs
checkin the same scratch worktree after each agent pass and re-drives until it exits 0 ormax_iterationsis exhausted. - Scenario
- A test case for a declarative agent: run it on
input, the output must containexpect(a stable substring — not an exact match, so the contract tolerates benign model variation). - Scenario
Results - Evaluate every scenario against the spec. Returns per-scenario pass/fail and the failures rendered for a repair prompt.
Enums§
- Build
Failure - A terminal agent-build cause that changing the generated spec cannot fix.
- Build
Progress Model - What one progress transition says about the model on screen.
- Context
Policy - Who owns the agent’s conversation context across a multi-turn run.
Traits§
Functions§
- build_
agent - Generate an agent spec from
intent, run its scenarios, and repair until they pass. Tool names the model invents that aren’t inavailable_toolsare dropped (the allowlist can only contain real tools). - build_
agent_ with_ progress build_agentwith progress transitions and the session’s cancel flag for a live coder session. A set flag ends the loop before its next attempt, and an in-flight scenario stops at its next turn boundary.- run_
scenarios - select_
tool_ defs_ strict - Filter the executor’s available tool schemas to the spec’s allowlist. Strict: an empty intersection yields ZERO tools (NOT all) — a typo’d or empty allowlist must never silently grant the full toolset. Denied tools are removed even if allowlisted.