effort

package
v0.9.21 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package effort defines the provider-neutral reasoning-effort scale shared by the Claude, Gemini, and OpenAI-compatible executor backends.

A single Level value expresses how deeply a model should think regardless of which backend runs the agent, so swapping models does not require retuning backend-specific knobs. Each executor exposes a WithEffort option that maps the level onto its provider's native control; see the Level documentation for the per-backend mappings.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level string

Level is the provider-neutral reasoning-effort scale shared by every executor backend. It controls how deeply a model thinks and its overall token spend. The scale follows the Anthropic effort levels — the superset across providers — and each backend maps it onto its native control:

  • Claude: output_config.effort, an identity mapping (claudeexecutor.WithEffort).
  • Gemini: thinkingLevel on Gemini 3.x models, thinkingBudget tiers on earlier models (googleexecutor.WithEffort).
  • OpenAI-compatible: reasoning_effort, where XHigh and Max clamp to "high" (openaiexecutor.WithEffort).

The zero value means "not configured": backends keep their model default, and Validate rejects it — express "no effort" by not passing the option.

const (
	// Low suits short, scoped tasks and latency-sensitive work that is not
	// intelligence-sensitive.
	Low Level = "low"
	// Medium trades some depth for cost; a step down from each backend's
	// default.
	Medium Level = "medium"
	// High balances depth and token spend; it is the Claude model default.
	High Level = "high"
	// XHigh is the recommended setting for hard coding/agentic work on
	// Claude. Backends without an equivalent clamp it to their maximum.
	XHigh Level = "xhigh"
	// Max spends whatever it takes; reserve it for correctness-critical work.
	// Backends without an equivalent clamp it to their maximum.
	Max Level = "max"
)

func (Level) Validate

func (l Level) Validate() error

Validate returns an error unless l is one of the defined levels. The empty string is invalid: leaving effort unconfigured is expressed by not passing the executor option, not by passing an empty Level.

Example
package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/agents/effort"
)

func main() {
	if err := effort.XHigh.Validate(); err != nil {
		fmt.Println("unexpected:", err)
	}

	if err := effort.Level("extreme").Validate(); err != nil {
		fmt.Println(err)
	}
}
Output:
invalid effort level "extreme" (want low|medium|high|xhigh|max)

Jump to

Keyboard shortcuts

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