Documentation
¶
Overview ¶
Package executor defines the result type returned by model CLI executors.
Index ¶
- Constants
- type AnthropicExecutor
- type CLIExecutor
- func (e *CLIExecutor) EffectiveTools() []string
- func (e *CLIExecutor) Execute(ctx context.Context, prompt string, _ ExecutionOptions) Result
- func (e *CLIExecutor) Run(ctx context.Context, prompt string) Result
- func (*CLIExecutor) RuntimeID() string
- func (e *CLIExecutor) Stream(ctx context.Context, prompt string, w io.Writer) error
- type CodexCLIExecutor
- func (*CodexCLIExecutor) EffectiveTools() []string
- func (e *CodexCLIExecutor) Execute(ctx context.Context, prompt string, options ExecutionOptions) Result
- func (e *CodexCLIExecutor) ExecuteWithEvents(ctx context.Context, prompt string, options ExecutionOptions, w io.Writer, ...) Result
- func (e *CodexCLIExecutor) Run(ctx context.Context, prompt string) Result
- func (*CodexCLIExecutor) RuntimeID() string
- func (e *CodexCLIExecutor) Stream(ctx context.Context, prompt string, w io.Writer) error
- type EventTaskExecutor
- type ExecutionOptions
- type OpenAIExecutor
- type Result
- type RuntimeAdapter
- type RuntimeEvent
- type RuntimeEventKind
- type TaskExecutor
- type ToolCapabilityStatus
- type ToolProvider
- type Usage
Constants ¶
const DefaultExecutionMaxTokens = 8192
DefaultExecutionMaxTokens is the bounded output budget used when a caller does not provide one for a task execution. Admission probes use their own, much smaller fixed budget and never use this value.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnthropicExecutor ¶
type AnthropicExecutor struct {
// contains filtered or unexported fields
}
AnthropicExecutor calls the Anthropic Messages API.
func NewAnthropicExecutor ¶
func NewAnthropicExecutor(apiKey, model string) *AnthropicExecutor
NewAnthropicExecutor creates an executor for the given Anthropic model.
func (*AnthropicExecutor) EffectiveTools ¶ added in v0.3.0
func (*AnthropicExecutor) EffectiveTools() []string
EffectiveTools returns nil because HTTP executors cannot invoke tools.
func (*AnthropicExecutor) Execute ¶
func (e *AnthropicExecutor) Execute(ctx context.Context, prompt string, options ExecutionOptions) Result
Execute sends a full task prompt with an explicit bounded output budget.
func (*AnthropicExecutor) Run ¶
func (e *AnthropicExecutor) Run(ctx context.Context, prompt string) Result
Run sends prompt to the Anthropic Messages API and returns the text response. It is the short admission-probe path and always uses the 512-token budget.
func (*AnthropicExecutor) RuntimeID ¶ added in v0.3.0
func (*AnthropicExecutor) RuntimeID() string
RuntimeID returns the executor's runtime identifier.
type CLIExecutor ¶
type CLIExecutor struct {
// contains filtered or unexported fields
}
CLIExecutor runs a subscription CLI (e.g. claude -p) to answer prompts. Cost is $0 marginal — the user pays a flat subscription, not per token.
func NewClaudeCLIExecutor ¶
func NewClaudeCLIExecutor(model string) *CLIExecutor
NewClaudeCLIExecutor creates an executor that shells out to the claude CLI. Requires claude (Claude Code) to be installed and already logged in.
func (*CLIExecutor) EffectiveTools ¶
func (e *CLIExecutor) EffectiveTools() []string
EffectiveTools returns the tool set available in claude -p during execution.
func (*CLIExecutor) Execute ¶
func (e *CLIExecutor) Execute(ctx context.Context, prompt string, _ ExecutionOptions) Result
Execute invokes the CLI for a full task. Claude Code owns its own context and output controls, so the shared token option is intentionally not added to the command line; the result still satisfies the same execution contract, with provider usage and truncation remaining unknown.
func (*CLIExecutor) Run ¶
func (e *CLIExecutor) Run(ctx context.Context, prompt string) Result
Run invokes the CLI and returns stdout as the model's response.
func (*CLIExecutor) RuntimeID ¶ added in v0.3.0
func (*CLIExecutor) RuntimeID() string
RuntimeID returns the executor's runtime identifier.
type CodexCLIExecutor ¶ added in v0.6.0
type CodexCLIExecutor struct {
// contains filtered or unexported fields
}
CodexCLIExecutor runs Codex through the user's existing CLI login.
func NewCodexCLIExecutor ¶ added in v0.6.0
func NewCodexCLIExecutor() *CodexCLIExecutor
func NewCodexCLIExecutorWithUnknownCost ¶ added in v0.6.0
func NewCodexCLIExecutorWithUnknownCost() *CodexCLIExecutor
NewCodexCLIExecutorWithUnknownCost preserves API-key and unrecognized Codex authentication as billable-unknown rather than subscription-free.
func (*CodexCLIExecutor) EffectiveTools ¶ added in v0.6.0
func (*CodexCLIExecutor) EffectiveTools() []string
func (*CodexCLIExecutor) Execute ¶ added in v0.6.0
func (e *CodexCLIExecutor) Execute(ctx context.Context, prompt string, options ExecutionOptions) Result
func (*CodexCLIExecutor) ExecuteWithEvents ¶ added in v0.6.0
func (e *CodexCLIExecutor) ExecuteWithEvents( ctx context.Context, prompt string, options ExecutionOptions, w io.Writer, emit func(RuntimeEvent), ) Result
ExecuteWithEvents consumes Codex's JSONL stream so long-running agent work remains observable without exposing command arguments or command output.
func (*CodexCLIExecutor) Run ¶ added in v0.6.0
func (e *CodexCLIExecutor) Run(ctx context.Context, prompt string) Result
func (*CodexCLIExecutor) RuntimeID ¶ added in v0.6.0
func (*CodexCLIExecutor) RuntimeID() string
type EventTaskExecutor ¶ added in v0.4.0
type EventTaskExecutor interface {
ExecuteWithEvents(context.Context, string, ExecutionOptions, io.Writer, func(RuntimeEvent)) Result
}
EventTaskExecutor streams task text while reporting structured runtime lifecycle events and returning complete usage/cost telemetry.
type ExecutionOptions ¶
type ExecutionOptions struct {
MaxOutputTokens int
}
ExecutionOptions controls a full task execution. MaxOutputTokens <= 0 uses DefaultExecutionMaxTokens so callers cannot accidentally request an unbounded provider response.
type OpenAIExecutor ¶
type OpenAIExecutor struct {
// contains filtered or unexported fields
}
OpenAIExecutor uses OpenAI Responses for GPT-5.6 and Chat Completions for older OpenAI models and compatible providers.
func NewOpenAICompatibleExecutor ¶
func NewOpenAICompatibleExecutor(apiKey, model, endpoint string) *OpenAIExecutor
NewOpenAICompatibleExecutor targets any OpenAI-compatible chat-completions endpoint (Ollama, LM Studio, vLLM, llama.cpp server). apiKey may be empty.
func NewOpenAIExecutor ¶
func NewOpenAIExecutor(apiKey, model string) *OpenAIExecutor
NewOpenAIExecutor creates an executor for the given OpenAI model.
func NewOpenRouterExecutor ¶
func NewOpenRouterExecutor(apiKey, model string) *OpenAIExecutor
NewOpenRouterExecutor creates an executor for OpenRouter (OpenAI-compatible API).
func NewXAIExecutor ¶
func NewXAIExecutor(apiKey, model string) *OpenAIExecutor
NewXAIExecutor creates an executor for xAI Grok models via the OpenAI-compatible endpoint at api.x.ai. Use XAI_API_KEY.
func (*OpenAIExecutor) EffectiveTools ¶ added in v0.3.0
func (*OpenAIExecutor) EffectiveTools() []string
EffectiveTools returns nil because HTTP executors cannot invoke tools.
func (*OpenAIExecutor) Execute ¶
func (e *OpenAIExecutor) Execute(ctx context.Context, prompt string, options ExecutionOptions) Result
Execute sends a full task prompt with an explicit bounded output budget.
func (*OpenAIExecutor) Run ¶
func (e *OpenAIExecutor) Run(ctx context.Context, prompt string) Result
Run sends prompt to the OpenAI-compatible API and returns the text response. It is the short admission-probe path and always uses the 512-token budget.
func (*OpenAIExecutor) RuntimeID ¶ added in v0.3.0
func (e *OpenAIExecutor) RuntimeID() string
RuntimeID returns the executor's runtime identifier.
type Result ¶
type Result struct {
Output string
Error error
Usage Usage
CostUSD float64
CostKnown bool
FinishReason string
Truncated bool
}
Result holds the output of a single model invocation.
type RuntimeAdapter ¶ added in v0.3.0
type RuntimeAdapter interface {
Run(ctx context.Context, prompt string) Result
TaskExecutor
ToolProvider
RuntimeID() string
}
RuntimeAdapter is the complete transport contract used by veto. Admission and execution remain separate methods with independent output budgets.
type RuntimeEvent ¶ added in v0.4.0
type RuntimeEvent struct {
Kind RuntimeEventKind
Name string
Status string
Count int
}
RuntimeEvent is the allowlisted event bridge from an agent runtime into Veto's ledger. Name is a validated tool or artifact kind, never arguments, output, paths, or file contents.
type RuntimeEventKind ¶ added in v0.4.0
type RuntimeEventKind string
RuntimeEventKind identifies safe, structured lifecycle events emitted by an agent runtime. Runtime adapters must not include prompts, tool arguments, tool output, credentials, or file contents in these events.
const ( RuntimeToolStarted RuntimeEventKind = "tool.started" RuntimeToolCompleted RuntimeEventKind = "tool.completed" RuntimeToolError RuntimeEventKind = "tool.error" RuntimeApprovalRequested RuntimeEventKind = "approval.requested" RuntimeApprovalGranted RuntimeEventKind = "approval.granted" RuntimeApprovalDenied RuntimeEventKind = "approval.denied" RuntimeArtifactCreated RuntimeEventKind = "artifact.created" )
type TaskExecutor ¶
type TaskExecutor interface {
Execute(ctx context.Context, prompt string, options ExecutionOptions) Result
}
TaskExecutor is implemented by transports that can perform a full task execution. Run remains the short admission-probe method for compatibility.
type ToolCapabilityStatus ¶ added in v0.4.0
type ToolCapabilityStatus interface {
EffectiveToolsKnown() bool
}
ToolCapabilityStatus distinguishes a known empty tool list from a runtime whose project/session-specific tools have not been discovered yet.
type ToolProvider ¶
type ToolProvider interface {
EffectiveTools() []string
}
ToolProvider reports tools the transport can actually invoke. Text-only runtimes return nil so model-declared capabilities never grant tool access.