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.
Click to show internal directories.
Click to hide internal directories.