Documentation
¶
Overview ¶
Package executor runs prompts against Hydra Heads. Two strategies: CLI (subprocess) and HTTP (OpenAI-compatible REST).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SupportsHTTP ¶
SupportsHTTP reports whether Hydra can execute the head over HTTP today.
func Unroutable ¶ added in v1.1.0
Unroutable explains why a discovered head cannot be dispatched to, or returns "" when it can.
This is the primary check and Supports delegates to it, so a surface that lists heads and a surface that routes to them cannot disagree. They did: `hyctl probe` advertised the PATH-discovered Ollama binary while `hyctl dispatch --local` refused and told the user to go look at `hyctl probe` (#248). Discovery finding a head and Hydra being able to drive it are different questions, and only one function should answer the second.
Types ¶
type AgyExecutor ¶
type AgyExecutor struct{}
AgyExecutor invokes `agy --print` with model selection via settings.json swap. Ports all logic from dispatch/agy.sh natively in Go.
type AuthRequiredError ¶
AuthRequiredError is returned when agy signals that authentication is needed.
func (*AuthRequiredError) Error ¶
func (e *AuthRequiredError) Error() string
type Executor ¶
Executor runs a prompt and returns a response.
func For ¶
For selects the correct Executor for a given Head.
- registry source (agy tiers): AgyExecutor → native (execs the `agy` binary)
- ollama source: OllamaExecutor → native /api/generate
- env source / port source / explicit endpoint: HTTPExecutor → per-provider REST
- everything else: CLIExecutor → subprocess
env-key heads (Source=="env") carry no Executable — they are API providers (anthropic, openai, groq, …). HTTPExecutor.Execute dispatches on Head.Provider and already has an adapter for each, so env heads route to HTTP, not CLI.
type HTTPExecutor ¶
type HTTPExecutor struct {
// contains filtered or unexported fields
}
HTTPExecutor runs prompts against HTTP-based providers.
type OllamaExecutor ¶
type OllamaExecutor struct {
// contains filtered or unexported fields
}
OllamaExecutor calls the Ollama native /api/generate endpoint. Before dispatching it health-checks the server and attempts auto-start. Ports dispatch/ollama.sh natively in Go.
type Request ¶
type Request struct {
Prompt string
Head provider.Head
MaxTokens int // 0 = provider default
System string // optional system prompt
}
Request is everything needed to execute a prompt against a Head.
type Response ¶
type Response struct {
Output string
InputTokens int
OutputTokens int
Duration time.Duration
Model string
Truncated bool // true when output exceeded the accumulator cap
// TokensEstimated is true when InputTokens/OutputTokens were derived by
// Hydra (e.g. agy's char/4 heuristic) rather than reported by the provider.
// HTTP and Ollama executors parse real usage and leave this false; the agy
// executor sets it true. Consumers must not present estimated tokens as
// measured spend.
TokensEstimated bool
}
Response is the result of a successful execution.