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

executor

package
v1.233.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultMaxToolIterations is the default maximum number of tool execution loops.
	DefaultMaxToolIterations = 25
)

Variables

This section is empty.

Functions

func ResultError

func ResultError(result *formatter.ExecutionResult) error

ResultError converts an execution result into the error a command should return. It returns nil for a successful result that has something to show.

Errors that already explain themselves (user aborts, and provider errors that carry hints) are returned unchanged. Other failures are wrapped in ErrAIExecutionFailed. A successful result with no text and no tool activity is an error, so the command never prints a blank answer.

Types

type Executor

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

Executor handles non-interactive AI execution with tool support.

func NewExecutor

func NewExecutor(client ai.Client, toolExecutor *tools.Executor, atmosConfig *schema.AtmosConfiguration) *Executor

NewExecutor creates a new non-interactive executor.

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, opts Options) *formatter.ExecutionResult

Execute runs a single prompt and returns the formatted result.

type Options

type Options struct {
	// Prompt is the user's prompt/question.
	Prompt string

	// ToolsEnabled indicates if tool execution is allowed.
	ToolsEnabled bool

	// SessionID is an optional session ID for conversation context.
	SessionID string

	// IncludeContext includes stack context in the prompt.
	IncludeContext bool

	// History contains prior conversation messages to prepend before Prompt.
	// Callers resuming a persisted session (see cmd/ai/session_helpers.go)
	// populate this from the session's stored messages; it is empty for a
	// fresh, session-less execution.
	History []types.Message
}

Options contains execution options.

Jump to

Keyboard shortcuts

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