Documentation
¶
Overview ¶
Package goals keeps a thread working toward its goal (harness v2 §6): the goal is part of every run's system prompt, each completed run is judged by a short model call, and an unmet goal gets a new run until its turns run out.
Index ¶
- Constants
- func ContextSection(st Store) agent.PromptSection
- func ContinueMessage(reason string, blockers ...string) string
- func Event(g *store.Goal, nextRunID string) map[string]any
- func NewRun(g *store.Goal, login, model, reasoningEffort, interactionMode, content string) store.NewRun
- func StartMessage(text string) string
- func TurnsSection(st Store) agent.PromptSection
- type Evidence
- type Hook
- type Store
Constants ¶
const ( MaxTextChars = 4000 DefaultMaxTurns = 8 MaxTurns = 20 // EvaluationFailed is the verdict reason when the judge gave no usable answer. EvaluationFailed = "evaluation failed" // MaxEvalFailures consecutive evaluation failures stop the auto-continuation. MaxEvalFailures = 2 )
Limits and texts of the contract.
const JudgeInstructions = `` /* 821-byte string literal not displayed */
JudgeInstructions is the system prompt of the evaluation call.
Variables ¶
This section is empty.
Functions ¶
func ContextSection ¶
func ContextSection(st Store) agent.PromptSection
ContextSection puts the active goal in the dynamic context of the prompt.
func ContinueMessage ¶
ContinueMessage is the user message of an automatic goal run.
func NewRun ¶
func NewRun(g *store.Goal, login, model, reasoningEffort, interactionMode, content string) store.NewRun
NewRun is a goal run of the thread: it claims one of the goal's turns. interactionMode is interactive or automatic ("": the thread's last choice).
func StartMessage ¶
StartMessage is the user message of the first goal run.
func TurnsSection ¶
func TurnsSection(st Store) agent.PromptSection
TurnsSection is the active goal's turn counter (agent.Harness.Tail: after the history, not in the system prompt).
Types ¶
type Evidence ¶
type Evidence = store.GoalEvidence
Evidence is what the judge sees of a deliverable of the run's turn (see store.GoalEvidence).
type Hook ¶
type Hook struct {
Store Store
Models llm.Factory
Queue queue.Queue
// ListArtifacts optionally names the thread's produced documents for the judge.
ListArtifacts func(ctx context.Context, threadID string) ([]string, error)
Now func() time.Time
// Timeout bounds the whole evaluation, retry included (default 20 s).
Timeout time.Duration
// Handoff optionally runs once a goal run is created, before it is
// enqueued: the web search token of the run that ended is handed to it
// (otherwise the new run could start without it).
Handoff func(ctx context.Context, prev, next *store.Run)
// Evidence optionally gives the judge the deliverables of the goal's
// turns (all of them since the goal was set, not only the run's) with
// their checker results and text (harness v3 §4: verify.Verifier.Evidence).
Evidence func(ctx context.Context, run *store.Run, g *store.Goal) []Evidence
// SupportsReasoning reports models that accept reasoningEffort: the judge
// then runs at low effort (A-25).
SupportsReasoning func(model string) bool
}
Hook evaluates the goal after each completed run (a runtime.Hook).
type Store ¶
type Store interface {
ThreadGoal(ctx context.Context, threadID string) (*store.Goal, error)
UpdateGoal(ctx context.Context, threadID string, u store.GoalUpdate) (*store.Goal, error)
ListMessages(ctx context.Context, threadID string) ([]*store.Message, error)
CreateRun(ctx context.Context, in store.NewRun) (*store.Run, *store.Message, error)
}
Store is the persistence used by goals.