Documentation
¶
Overview ¶
Package delegation runs an explicit bounded local-first task policy. It can escalate once after a known complete durable answer fails declared checks; it never retries uncertain calls, intercepts an agent session, or picks models.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrQualityFailed = errors.New("delegated task did not satisfy every declared quality check") ErrStopped = errors.New("delegated task stopped without escalating; inspect its recorded outcome") )
Functions ¶
Types ¶
type Attempt ¶
type Attempt struct {
TierID string `json:"tier_id"`
Result inference.Result `json:"result"` // Response.Text is always stripped.
Checks []evaluation.CheckResult `json:"checks"`
QualityPassed bool `json:"quality_passed"`
OutputSHA256 string `json:"output_sha256,omitempty"`
ErrorCategory string `json:"error_category,omitempty"`
}
type Request ¶
type Request struct {
Spec inference.Spec `json:"spec"`
Policy Policy `json:"policy"`
Checks []evaluation.Check `json:"checks"`
}
Request.Spec supplies approved task, revision, prompt and context only. Every model and resource setting comes from the explicit tier templates.
type Result ¶
type Result struct {
RequestSHA256 string `json:"request_sha256"`
Attempts []Attempt `json:"attempts"`
SelectedTier string `json:"selected_tier,omitempty"`
Response *inference.Response `json:"response,omitempty"` // Only a passing answer is exposed.
Status string `json:"status"` // completed, quality_failed, stopped
}
type Router ¶
type Router struct {
Factory RunnerFactory
AllowPaid bool // Caller permission, never read from request JSON or environment.
}
func (Router) Run ¶
Run executes at most two explicitly configured tiers. A second tier is reached only after error-free, known complete and durable output fails the declared checks. Every provider/accounting error stops the whole policy. Repeated calls retain the same request/tier identity and the Runner's reuse behavior; the Router never changes a revision to force another generation.