goals

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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.

View Source
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

func ContinueMessage(reason string, blockers ...string) string

ContinueMessage is the user message of an automatic goal run.

func Event

func Event(g *store.Goal, nextRunID string) map[string]any

Event is the work.goal value: the goal and the run started to continue it.

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

func StartMessage(text string) string

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).

func (*Hook) Finishing

func (h *Hook) Finishing(ctx context.Context, f *runtime.Finish) func(context.Context)

Finishing implements runtime.Hook. Runs that failed, were cancelled, only compacted, or wait for an ask_user answer are not judged.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL