Skip to main content

Module declarative

Module declarative 

Source
Expand description

In-daemon execution of declarative agents, and the coder→agent build loop.

Two pieces:

  • DeclarativeAgentRunner runs a DeclarativeAgentSpec on 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’s InspectorChain. No external process.
  • build_agent is 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§

AgentGoalRun
AgentRunResult
Result of one declarative-agent run.
BuildAgentConfig
Tunables for build_agent.
BuildAgentOutcome
Outcome of the build loop.
BuildAgentProgressUpdate
One progress transition from the build loop. The RPC adapter persists these in the coder session; other callers use the no-op reporter.
DeclarativeAgentRunner
Runs a declarative agent in-daemon.
DeclarativeAgentSpec
A declarative, in-daemon agent.
DeclarativeGoal
Deterministic completion contract for a declarative agent invocation. The daemon runs check in the same scratch worktree after each agent pass and re-drives until it exits 0 or max_iterations is exhausted.
Scenario
A test case for a declarative agent: run it on input, the output must contain expect (a stable substring — not an exact match, so the contract tolerates benign model variation).
ScenarioResults
Evaluate every scenario against the spec. Returns per-scenario pass/fail and the failures rendered for a repair prompt.

Enums§

BuildFailure
A terminal agent-build cause that changing the generated spec cannot fix.
BuildProgressModel
What one progress transition says about the model on screen.
ContextPolicy
Who owns the agent’s conversation context across a multi-turn run.

Traits§

BuildAgentProgressReporter

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 in available_tools are dropped (the allowlist can only contain real tools).
build_agent_with_progress
build_agent with 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.