agent

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultModel  = string(anthropic.ModelClaudeOpus4_8)
	DefaultEffort = string(anthropic.OutputConfigEffortHigh)

	// MaxTokens stays under the SDK HTTP timeout for non streaming requests.
	MaxTokens = 16000

	// MaxRepairAttempts bounds how many times we hand a validation error back to
	// the model. Transport errors are not counted here - the SDK already retries
	// 429/5xx/connection failures on its own.
	MaxRepairAttempts = 3
)
View Source
const SystemPrompt = `` /* 8622-byte string literal not displayed */

Variables

This section is empty.

Functions

func ValidateConfig added in v1.3.1

func ValidateConfig(cfg *config.CliItem) error

ValidateConfig catches the structural mistakes that would otherwise surface as a confusing nil dereference or an empty result at execution time.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

func NewAgent

func NewAgent(cfg AgentConfig) (*Agent, error)

func (*Agent) Execute

func (a *Agent) Execute(cfg *config.CliItem) (string, error)

func (*Agent) GenerateConfig

func (a *Agent) GenerateConfig(ctx context.Context, request string) (*Result, error)

GenerateConfig turns a natural language request into a validated Fitter config. Follow up calls on the same Agent refine the previous result, so "make it return 20 items instead" works without repeating the original ask.

func (*Agent) HasHistory added in v1.3.1

func (a *Agent) HasHistory() bool

HasHistory reports whether a previous config exists to refine.

func (*Agent) Reset added in v1.3.1

func (a *Agent) Reset()

Reset clears the conversation. The next request starts a fresh session.

func (*Agent) SetLimits

func (a *Agent) SetLimits(limits *config.Limits)

type AgentConfig

type AgentConfig struct {
	// APIKey is optional. When empty the SDK resolves credentials from the
	// environment (ANTHROPIC_API_KEY and friends).
	APIKey  string
	Model   string
	Effort  string
	Logger  logger.Logger
	Limits  *config.Limits
	Verbose bool
}

type REPL

type REPL struct {
	// contains filtered or unexported fields
}

func NewREPL

func NewREPL(agent *Agent, verbose bool) *REPL

func (*REPL) Run

func (r *REPL) Run(ctx context.Context) error

type Result added in v1.3.1

type Result struct {
	Config *config.CliItem
	// JSON is the config, re-indented for display.
	JSON  string
	Notes string
}

Result is a validated config plus the material needed to display it.

Jump to

Keyboard shortcuts

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