agents

package
v0.0.0-...-6a7d141 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentVersion

func AgentVersion(ctx context.Context, def Definition) (string, error)

AgentVersion returns the actual version reported by the agent harness.

Types

type Agent

type Agent interface {
	Version() (string, error)
	Run(cwd string, llm LLMDefinition, session string, instructions string, opts RunOptions) RunResults
}

type Definition

type Definition struct {
	Name         string   `yaml:"name"`
	Version      string   `yaml:"version"`
	SupportsLLMs []string `yaml:"supports-llms"`
}

type LLMCostDefinition

type LLMCostDefinition struct {
	InputCost           *float64 `yaml:"input-cost"`
	CachedInputCost     *float64 `yaml:"cached-input-cost"`
	CacheWriteInputCost *float64 `yaml:"cache-write-input-cost"`
	OutputCost          *float64 `yaml:"output-cost"`
}

func (*LLMCostDefinition) IsComplete

func (c *LLMCostDefinition) IsComplete() bool

type LLMDefinition

type LLMDefinition struct {
	Name           string             `yaml:"name"`
	Model          string             `yaml:"model"`
	ReasoningLevel string             `yaml:"reasoning-level"`
	PerAgent       map[string]string  `yaml:"per-agent"`
	Costs          *LLMCostDefinition `yaml:"costs"`
}

type Registry

type Registry struct {
	Agents map[string]Definition
	LLMs   map[string]LLMDefinition
}

func LoadRegistry

func LoadRegistry(root string) (*Registry, error)

func (*Registry) Agent

func (r *Registry) Agent(name string) (Definition, bool)

func (*Registry) LLM

func (r *Registry) LLM(name string) (LLMDefinition, bool)

func (*Registry) ValidateAgentModel

func (r *Registry) ValidateAgentModel(agentName, model string) (Definition, *LLMDefinition, error)

ValidateAgentModel ensures the agent and model exist and the model is supported.

type RunContext

type RunContext struct {
	ScenarioName string
	ScenarioPath string
	ModelName    string
	LLM          *LLMDefinition
	Agent        Definition
	Instructions string
	Session      string
	Options      RunOptions
	Printer      *output.Printer
}

type RunOptions

type RunOptions struct {
	// Package is an optional Go package path (relative to the workspace root)
	// that an agent may use to scope work (ex: "internal/cli").
	Package string
}

type RunOutcome

type RunOutcome struct {
	Progress *types.RunProgress
}

func Run

func Run(ctx context.Context, rc RunContext) (*RunOutcome, error)

Run invokes the harness for the given agent.

type RunResults

type RunResults struct {
	// Transcript is the full transcript
	Transcript string

	InputTokens            int     // number of uncached input tokens. This is essentially context used
	CachedInputTokens      int     // number of cached input tokens. As a convo is renetered with tool call results, the old parts accumulate here.
	WriteCachedInputTokens int     // number of tokens spent writing content to the cache
	OutputTokens           int     // number of reasoning/output tokens
	Cost                   float64 // total cost for the run (if available)

	// ScaleDuration, when >0, scales the wall-clock DurationSeconds recorded in RunProgress.
	// A value of 0 means "unscaled" (use the measured elapsed time).
	// The purpose of this is to, for example, adjust ChatGPT Pro's Priority Processing back to "apples-to-apples" times.
	// A better solution might be to just not use ChatGPT Pro's auth, but that would cost more money/time to run.
	ScaleDuration float64

	// If an agent supports it, this is the session ID (or resume ID). We can pass this ID to future Run calls to continue.
	Session string

	// Error is any error produced by trying to run the agent.
	Err error
}

RunResults contains the details returned by an Agent Run invocation.

Jump to

Keyboard shortcuts

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