Help us shape the future of Go! Take the 2026 Go Developer Survey

agent

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package agent runs the step loop: query the model, execute tool calls, repeat.

Index

Constants

View Source
const (
	StatusSubmitted   = "Submitted"
	StatusCompleted   = "Completed" // model stopped calling tools without the submit marker
	StatusStepLimit   = "StepLimitExceeded"
	StatusCostLimit   = "CostLimitExceeded"
	StatusTimeLimit   = "TimeLimitExceeded"
	StatusInterrupted = "Interrupted"
	StatusError       = "Error"
)
View Source
const SubmitMarker = "COMPLETE_TASK_AND_SUBMIT_FINAL_OUTPUT"

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	Model     model.Model
	ModelName string
	Tools     *tools.Executor
	Config    config.AgentConfig
	Out       io.Writer // progress log; nil discards
	Err       io.Writer // warnings; nil discards
	Verbose   bool
	// Streamed means the model already wrote its text to Out as it arrived.
	Streamed bool
	// SkipAgentsMD stops Run from appending the nearest AGENTS.md at or above
	// <root> to the system prompt.
	SkipAgentsMD bool
	// OnStep is called after every step, e.g. to save the trajectory.
	OnStep func(*trajectory.Trajectory)
}

func (*Agent) Run

func (a *Agent) Run(ctx context.Context, task string) *trajectory.Trajectory

Run executes task until submission, a limit, or an error. It always returns a trajectory describing how the run ended.

Jump to

Keyboard shortcuts

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