Behaviour for pluggable AI model integration.
Agents are backend-agnostic -- they call complete/2 or stream/2
and the backend handles the model-specific HTTP/inference details.
Implementations:
Raxol.Agent.Backend.HTTP-- Req-based client for Claude, GPT, Ollama, Kimi, OpenRouterRaxol.Agent.Backend.Lumo-- Proton Lumo with U2L encryption (or lumo-tamer proxy)Raxol.Agent.Backend.Mock-- Deterministic responses for testing
Summary
Callbacks
Check if the backend is currently available.
List of supported capabilities.
Send messages and receive a complete response.
Whether the backend runs its own internal tool-call loop.
Maximum context window in tokens, or nil when unknown.
Human-readable name of the backend.
Send messages and receive a stream of events.
Functions
Query whether a backend handles tools internally, defaulting to false.
Query a backend's max context window, defaulting to nil.
Types
Callbacks
@callback available?() :: boolean()
Check if the backend is currently available.
@callback capabilities() :: [:completion | :streaming | :tool_use | :vision]
List of supported capabilities.
Send messages and receive a complete response.
@callback handles_tools_internally?() :: boolean()
Whether the backend runs its own internal tool-call loop.
When true, the vendor owns the agent loop (e.g. a wrapped Claude Code or
Codex CLI) and the framework must NOT drive tool dispatch itself -- it injects
its tools into the vendor instead. When false (the default), the framework's
ReAct loop drives tool calls. Defaults to false for backends that omit it.
@callback max_context_tokens() :: pos_integer() | nil
Maximum context window in tokens, or nil when unknown.
@callback name() :: String.t()
Human-readable name of the backend.
@callback stream([message()], opts :: keyword()) :: {:ok, Enumerable.t()} | {:error, term()}
Send messages and receive a stream of events.
Functions
Query whether a backend handles tools internally, defaulting to false.
Safe to call on any backend module: backends that do not implement the optional callback are treated as framework-driven.
@spec max_context_tokens(module()) :: pos_integer() | nil
Query a backend's max context window, defaulting to nil.