Documentation
¶
Overview ¶
Package finishguard installs verify-on-stop: a bounded second look before a normal finish is accepted.
The guard never runs checks itself. It turns passive run evidence — the tool trace, the answer text — into one synthetic follow-up at the exact moment the model tries to finish, which is the only moment where "you did not actually check that" is both cheap to say and still actionable.
It is consulted only on a NORMAL finish (the model produced a text answer with no tool calls). A budget wrap-up, a tool-budget stop, a MaxTurns stop, an abort, or a terminal tool never re-opens the run: those are stops the run did not choose, and nudging them would wedge it.
Generalized from hermes-agent's turn-end verification guard.
Index ¶
Constants ¶
const DefaultMaxNudges = 2
DefaultMaxNudges caps injections per run so a guard that is never satisfied cannot loop the run against MaxTurns (hermes max_attempts).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Guard ¶
Guard is consulted when the model produces a final answer and the run would end normally. Returning a non-empty string injects it as a synthetic user message — persisted to the durable log like a steer — and the loop continues instead of returning, giving the model a bounded chance to verify or repair before finishing. Returning "" accepts the finish.
type Plugin ¶
type Plugin struct {
Guard Guard
// MaxNudges bounds injections per run. 0 uses DefaultMaxNudges. The cap
// lives here rather than in the loop because it is this capability's
// property: the loop only knows that SOMETHING asked to continue.
MaxNudges int
}
Plugin installs the guard. A nil Guard accepts every finish, so a composition that wires the plugin but has nothing to check is inert rather than broken.
type State ¶
type State struct {
// Final is the assistant text the run would return.
Final string
// Turns is the number of reasoning turns consumed, including this one.
Turns int
// Tools is the run's tool trace so far (allowed and blocked calls).
Tools []agentcore.ToolTrace
// Nudges counts guard messages already injected this run (0 on the first
// consultation), so a guard can weaken or drop its demand on the retry.
Nudges int
}
State is the evidence snapshot handed to a Guard: the answer the model just produced, the run shape so far, and how many nudges this guard has already spent. Tools aliases the run's live trace slice — read-only.