Raxol.Agent.ExecutorConfig (Raxol Agent v2.6.0)

Copy Markdown View Source

Explicit {harness, model, auth} configuration for an agent executor.

This is the front door for selecting where an agent's turns run. A harness names the runtime/vendor (:anthropic, :openai, :lumo, ...); model and auth say which model behind it and with what credentials. This replaces the implicit base_url substring detection in Raxol.Agent.Backend.HTTP with a named, declarative struct.

Resolve a config to a concrete backend module + options with Raxol.Agent.Backend.Selector.select/1. The struct itself only knows how to flatten itself into the keyword list backends already consume (to_backend_opts/1).

Examples

iex> Raxol.Agent.ExecutorConfig.new(harness: :anthropic, model: "claude-opus-4-8")
%Raxol.Agent.ExecutorConfig{harness: :anthropic, model: "claude-opus-4-8", auth: %{}, opts: []}

iex> cfg = Raxol.Agent.ExecutorConfig.new(harness: :openai, model: "gpt-5", auth: %{api_key: "sk-x"})
iex> Raxol.Agent.ExecutorConfig.to_backend_opts(cfg)
[model: "gpt-5", api_key: "sk-x"]

Summary

Functions

Alias for new/1 to read naturally when parsing external keyword config.

Build an ExecutorConfig from a keyword list or map.

Flatten this config into the keyword options a backend consumes.

Types

harness()

@type harness() ::
  :anthropic
  | :openai
  | :kimi
  | :ollama
  | :llm7
  | :openrouter
  | :lumo
  | :mock
  | :claude_native
  | :codex
  | :cursor

t()

@type t() :: %Raxol.Agent.ExecutorConfig{
  auth: map(),
  harness: harness(),
  model: String.t() | nil,
  opts: keyword()
}

Functions

from_keyword(kw)

@spec from_keyword(keyword()) :: t()

Alias for new/1 to read naturally when parsing external keyword config.

new(attrs)

@spec new(keyword() | map()) :: t()

Build an ExecutorConfig from a keyword list or map.

Recognized keys: :harness (required), :model, :auth, :opts. The :harness value is required and must be an atom.

to_backend_opts(executor_config)

@spec to_backend_opts(t()) :: keyword()

Flatten this config into the keyword options a backend consumes.

Order of precedence (later wins): auth fields, then explicit :opts, with the :model placed first so an :opts-supplied model can still override it.