Models, budgets and limits
View SourceExAgent uses stock ReqLLM to connect to OpenAI, Anthropic, Google Gemini, OpenRouter, Azure, Vertex, Amazon Bedrock and local OpenAI-compatible servers (Ollama, vLLM, LM Studio, llama.cpp) through one consistent Elixir contract.
What ExAgent simplifies:
- One-line model selection: Pass
"anthropic:claude-sonnet-5-5"or"ollama:llama3.3"— ExAgent resolves the wire profile automatically without hand-wiring HTTP clients. - Explicit credential ownership: Use environment keys for quick scripts or
pass per-tenant
api_key:/auth_token:on the model struct without ever leaking keys into snapshots or logs. - Safe tool calls & local thinking models: ExAgent validates complete tool envelopes before running any tool, automatically asks models to fix malformed envelopes when retry budget allows, and streams thinking tokens from local reasoning models cleanly.
- Hard production guardrails on cost and scale: Enforce request/tool caps
(
UsageLimits), shared RPM/TPM/concurrency queues (RateLimiter), PostgreSQL spend budgets (UsageLimits.Budget), automatic context compaction and model fallbacks.
Need exact wire profiles, error tuples or accounting schemas?
For exhaustive provider wire rules, accounting field definitions and quota measurements, see Tools & models contracts.
Choose by task
Pick the simplest model configuration that matches what your feature needs:
| Task | Recommended setup |
|---|---|
| Local development & offline tests | model: "test" or %ExAgent.Models.Test{script: [...]} |
| General cloud assistant with tools & Ecto output | "anthropic:claude-sonnet-5-5", "openai:gpt-5.5", or "google:gemini-3.5-flash" |
| Local / self-hosted inference (0 € cost) | "ollama:llama3.3", "vllm:my-model", or "lmstudio:my-model" |
| Multi-tenant SaaS with per-customer keys | ExAgent.Models.ReqLLM.new(model: ..., api_key: tenant_key) |
| Multi-provider routing or gateway (OpenRouter) | Explicit model map + ExAgent.Models.Fallback |
| Long conversations approaching context limit | Add ExAgent.Compaction.capability/2 + context_overflow: |
Image results from tools
If your tools return images (result_mode: :multimodal), use a model profile
that accepts image tool returns: Anthropic Messages, OpenAI Responses, Gemini,
or a Chat endpoint whose capabilities declare :image input.
Copy a tested gateway configuration
Here is a complete, explicit gateway configuration reaching a model through OpenRouter's OpenAI Chat endpoint with reasoning disabled:
model = ExAgent.Models.ReqLLM.new(
model: %{
provider: :openai, id: "openai/gpt-6-luna",
capabilities: %{
tools: %{enabled: true},
reasoning: %{enabled: true, effort: %{supported: true, values: ["none"]},
thinking: %{supported: true, disable_supported: true}}
},
modalities: %{input: [:text, :image], output: [:text]},
extra: %{wire: %{protocol: "openai_chat"}}
},
base_url: "https://openrouter.ai/api/v1",
api_key: System.fetch_env!("OPENROUTER_API_KEY"),
profile: :chat_tools_v1, reasoning_mode: :disabled, total_timeout: 45_000
)Verify any new gateway/model pairing with mix exagent.qualify before shipping
to production (see Supported features and limits).
Connect a catalogue model in one line
For standard cloud providers, pass "provider:model_id" directly:
agent = ExAgent.new(model: "anthropic:claude-sonnet-5-5", tools: tools)ExAgent resolves the profile from the local catalogue without IO and reads the
provider's API key at request time via ReqLLM.Keys (checking config :req_llm
then environment variables like ANTHROPIC_API_KEY or OPENAI_API_KEY). The
key is never stored on the %ExAgent{} struct or persisted in snapshots.
Local models
Point ExAgent directly at Ollama, vLLM or LM Studio using the
"ollama:...", "vllm:..." or "lmstudio:..." prefixes (for llama.cpp
OpenAI-compatible servers, use "vllm:<model_id>" with base_url:):
agent = ExAgent.new(model: "ollama:llama3.3", tools: tools)- Zero warning noise on custom local IDs: ExAgent retains catalogue metadata for known IDs and builds an inline stock model spec for unlisted local model names automatically.
- Custom host or port (
vllm:/llama.cpp):ExAgent.Models.ReqLLM.new(model: "vllm:my-model", base_url: "http://127.0.0.1:8035/v1", api_key: key). - Local thinking models & structured output:
:chat_tools_v1preserves plain unsigned thinking blocks (reasoning_content/<think>) and streams:thinking_deltaevents while omitting plain thinking on replay. For Ecto or JSON Schema output on local routes, useoutput_mode: :tool(default) oroutput_mode: :prompted(:nativeis rejected on:chat_tools_v1):
local_model =
ExAgent.Models.ReqLLM.new(
model: "vllm:my-local-model",
base_url: "http://127.0.0.1:8035/v1",
api_key: System.fetch_env!("OPENAI_API_KEY")
)
agent =
ExAgent.new(
model: local_model,
tools: MyApp.BillingTools.tools(),
output: MyApp.RefundSummary,
output_mode: :tool,
output_retries: 2
)- Verify your local server: Run
mix exagent.doctor --model ollama:llama3.3andmix exagent.qualify --model ollama:llama3.3to verify your server's tool parser before relying on it in production.
Resolve a model with instance credentials
When your application owns credentials explicitly (for instance, per-tenant
BYOK keys), resolve the model once with api_key: (or auth_token: for
Anthropic / Vertex OAuth bearers). ExAgent will never fall back to global
environment variables:
{:ok, model} = ExAgent.Model.resolve({:openai, id: "gpt-4o-mini"},
api_key: System.fetch_env!("OPENAI_API_KEY")
)
agent = ExAgent.new(model: model, instructions: "Be concise.")Keep credential-bearing model structs out of logs and persisted snapshots.
Configure an explicit endpoint
For private gateways, fine-tunes or models absent from the local catalogue, declare the wire protocol and capabilities explicitly as a map:
model = ExAgent.Models.ReqLLM.new(
model: %{
provider: :openai,
id: "gpt-4o-mini",
capabilities: %{tools: %{enabled: true}, reasoning: %{enabled: false}},
extra: %{wire: %{protocol: "openai_chat"}}
},
api_key: System.fetch_env!("OPENAI_API_KEY")
)Azure, Vertex, Bedrock
Cloud enterprise hosts work through stock ReqLLM with explicit base_url: or
provider options:
model = ExAgent.Models.ReqLLM.new(
model: "azure:gpt-4o-mini",
base_url: "https://my-resource.openai.azure.com/openai/v1",
api_key: System.fetch_env!("AZURE_OPENAI_API_KEY"),
provider_options: [deployment: "support-assistant"]
)
agent = ExAgent.new(model: model, tools: tools)For Vertex and Bedrock, configure credentials/region in ReqLLM and omit
base_url: so stock ReqLLM derives the regional endpoint automatically.
Amazon Bedrock InvokeModel
Use Bedrock's InvokeModel route when targeting a model configured for direct
invocation via ReqLLM's Bedrock provider options. Verify tool and streaming
support with mix exagent.qualify.
Amazon Bedrock Converse
Use Bedrock's Converse wire route for unified multi-model chat and tool
calling across Bedrock models; check Supported features and limits
for verified modality boundaries.
Profiles
ExAgent maps every ReqLLM model to a concrete wire profile (:openai_responses_v1,
:anthropic_messages_v1, :gemini_v1, :chat_tools_v1, :text_v1, etc.) so
incompatible combinations fail eagerly before wasting money or mis-parsing a
stream. Inspect any model's resolved profile with ExAgent.Model.profile/1 or
mix exagent.doctor --model <id>.
Tool argument envelope
At the stock ReqLLM wire boundary, every ExAgent tool call validates that the
model returned a complete, well-formed JSON argument envelope
({"arguments": {...}}) before any tool executes.
- What happens if a model flattens or mis-shapes a complete JSON object?
In live runs and persisted single-agent (Frame 3) continuations, ExAgent
invalidates the entire batch (zero side effects), appends a clear correction
notice, and asks the model to try again — spending each distinct function
tool's
:max_retries(or:output_retriesonce if the batch includes an output tool). - What stays immediately fatal (
:invalid_tool_arguments)? Truncated or unparseable JSON, non-object payloads, observable duplicate keys, stock argument errors, zero or exhausted retry budget, or malformed envelopes in durable workflow steps (Frame 10/11) — guaranteeing a cut-off stream never executes a half-parsed tool call.
Choose the reasoning mode
Turn reasoning on or off explicitly per model instance so fast extraction jobs don't pay reasoning latency while complex planning agents do:
model = ExAgent.Models.ReqLLM.new(
model: "openai:gpt-5.5",
api_key: key,
reasoning_mode: :enabled,
reasoning_effort: "medium"
)Supported modes are :disabled, :enabled, and :omit (leave provider
default untouched).
Preserve prefix-bound reasoning
Providers like Anthropic (signed thinking blocks) and OpenAI Responses
(encrypted reasoning items) tie opaque reasoning tokens to the exact message
prefix. ExAgent preserves those native blocks across tool rounds automatically
within the same provider, and rejects unsafe cross-provider replay unless you
explicitly opt into foreign_history: :portable.
Model terminals
ExAgent normalizes provider finish reasons (:stop, :tool_calls, :length,
:content_filter, :error, etc.). Any non-:stop / non-:tool_calls
terminal fails the run cleanly with {:incomplete_response, finish_reason} in
%ExAgent.RunError{} so truncated outputs (:length) and refusals are never
mistaken for a complete answer.
Route OpenRouter Chat tools explicitly
Pin a specific upstream provider on OpenRouter with openrouter_provider: when
you need deterministic tool-calling compliance:
model = ExAgent.Models.ReqLLM.new(
model: %{
provider: :openrouter,
id: qualified_model_id,
capabilities: %{tools: %{enabled: true}, reasoning: %{enabled: false}},
extra: %{wire: %{protocol: "openai_chat"}}
},
api_key: System.fetch_env!("OPENROUTER_API_KEY"),
provider_options: [
openrouter_provider: %{only: [qualified_provider_id], allow_fallbacks: false}
]
)Keep reasoning on with OpenRouter tools
Combine explicit OpenRouter routing with reasoning_mode: :enabled and
reasoning_effort: "medium" on reasoning-capable models that preserve tool
calling cleanly.
Cache stable prompt prefixes
Enable prompt caching on long static system prompts or large reference blocks to cut latency and input token costs:
model = ExAgent.Models.ReqLLM.new(
model: openrouter_spec,
api_key: System.fetch_env!("OPENROUTER_API_KEY"),
prompt_cache: [ttl: "5m"]
)Flex with fallback to Standard
Save money on batch jobs by trying OpenAI's :flex tier first and falling
back seamlessly to :default on 429 capacity limits:
alias ExAgent.Models.{Fallback, ReqLLM}
opts = [model: "openai:gpt-6-luna", api_key: System.fetch_env!("OPENAI_API_KEY")]
flex = ReqLLM.new([service_tier: :flex] ++ opts)
standard = ReqLLM.new([service_tier: :default] ++ opts)
model = Fallback.new(models: [flex, standard], max_retries: 0, retry_statuses: [429])
agent = ExAgent.new(model: model)Send images and documents
Pass a list of content parts instead of a plain string to send images, PDFs or provider-hosted files alongside text:
ExAgent.run(agent, [
%{type: "text", text: "Summarize the report and describe the chart."},
%{type: "image", data: Base.encode64(png), media_type: "image/png"},
%{type: "file", data: Base.encode64(pdf), media_type: "application/pdf",
filename: "report.pdf"}
])ExAgent validates UTF-8, Base64, URL schemes, model modality support and
:max_history_bytes before making any HTTP request (oversized prompts fail
cleanly with {:retention_limit_exceeded, %{boundary: :input, ...}}).
Remember that Base64 adds ~33% to raw file size.
Attach a provider-hosted PDF to a Gemini turn
Avoid re-uploading large PDFs by passing a Gemini Files API reference:
alias ExAgent.Message.Part.User
agent = ExAgent.new(model: "google:gemini-3.5-flash-lite")
reference = User.file_reference(:google, pdf_uri, "application/pdf", pdf_size_bytes)
ExAgent.run(agent, [%{type: :text, text: "Summarize the report."}, reference])Attach audio to a Gemini turn
Send inline audio clips to audio-capable Gemini models (works with streaming replies too):
agent = ExAgent.new(model: "google:gemini-3.5-flash-lite")
ExAgent.run(agent, [
%{type: "text", text: "Summarize this recording."},
%{type: "file", data: Base.encode64(wav), media_type: "audio/wav", filename: "clip.wav"}
], stream_text: true)Attach an Anthropic-hosted file
Pass an Anthropic Files API ID the same way:
reference = ExAgent.Message.Part.User.file_reference(:anthropic, uploaded_id, "application/pdf", size_bytes)
ExAgent.run(agent, [reference])Run bounded media operations
ExAgent.Media provides bounded transcription (transcribe/3), speech
synthesis (speak/3) and image generation (generate_image/3) — sharing the
same rate_limiter:, spend_budget: and byte/timeout guards as chat runs:
alias ExAgent.Media
defmodule MyApp.Voice do
def transcript(bytes, quota) do
Media.transcribe("openai:whisper-1", {:binary, bytes, "audio/wav"},
rate_limiter: quota,
max_input_bytes: 500_000,
timeout: 10_000
)
end
endExpose media operations directly to an agent with ExAgent.Media.tools/1
(backed by a ResultStore so large binary outputs stay out of chat history).
Qualify media providers
Check Supported features and limits and test your exact media model with small synthetic fixtures before enabling it for end users.
Embed text and rerank documents
ExAgent.Embeddings exposes bounded vector embeddings and document reranking
with the same quota and spend-budget controls — usable directly from Elixir or
wrapped as agent tools via Embeddings.tools/1:
alias ExAgent.Embeddings
{:ok, %{vectors: [vector], usage: usage}} =
Embeddings.embed("openai:text-embedding-3-small", "a green lantern",
rate_limiter: quota,
spend_budget: budget,
estimated_tokens: 32,
req_llm: [dimensions: 128]
)
{:ok, %{results: ranks}} =
Embeddings.rerank("cohere:rerank-v3.5", query, documents,
rate_limiter: quota,
spend_budget: budget,
estimated_tokens: 512,
req_llm: [top_n: 3]
)Classify with a decision model
ExAgent.Classifier gives you fast, closed-set classification backed by either
an LLM (Classifier.ReqLLM) or an in-BEAM Nx.Serving (Classifier.NxServing
with Bumblebee) — reusable for routing, guardrails
and evaluations:
alias ExAgent.Classifier
classifier =
Classifier.new(
adapter: Classifier.ReqLLM.new("openai:gpt-6-luna"),
instructions: "Which team should handle this request?",
labels: %{"billing" => "Payments or refunds", "support" => "Other requests"}
)
{:ok, decision} = Classifier.classify(classifier, "Can you refund my last payment?")
decision.labelRead citations from a response
When a provider returns grounded source citations, read them with
ExAgent.Result.citations/1 and slice the exact UTF-8 answer span:
alias ExAgent.Message.{Citation, Part}
citation =
Citation.new(:document, "2026-report",
quote: "42 units",
source_range: %Citation.Range{unit: :page, start: 2, end: 3},
answer_range: %Citation.Range{unit: :byte, start: 0, end: 10}
)
response =
ExAgent.Message.new_response([%Part.Text{content: "The report states 42."}],
citations: [citation],
finish_reason: :stop
)
agent = ExAgent.new(model: %ExAgent.Models.Test{script: [response]})
{:ok, result} = ExAgent.run(agent, "What does the report say?")
[%Citation{answer_range: %Citation.Range{start: first, end: last}}] =
ExAgent.Result.citations(result)
binary_part(result.output, first, last - first)
# => "The report"Read assistant narration
Models often emit short status text ("Let me check order #42…") in the same
turn as a tool call. ExAgent keeps that narration separate from the final
answer — stream it as :commentary_delta for responsive UIs while delivering
only the validated terminal answer as result.output.
Compact long conversations
Long tool-heavy threads hit context windows quickly. ExAgent.Compaction
projects a smaller next model request while keeping canonical conversation
history untouched:
alias ExAgent.Compaction
edit = Compaction.capability(Compaction.ClearToolResults,
threshold_tokens: 12_000,
keep_recent: 3,
exclude_tools: ["decisions"],
keep_call_ids: ["baseline"]
)
agent = ExAgent.new(model: %ExAgent.Models.Test{}, capabilities: [edit])
{:ok, %{status: :succeeded}} = ExAgent.run(agent, "Start")For older dialogue turns, use ExAgent.Compaction.Summary with an
ExAgent.Compaction.Memo cache so summaries are not recomputed on every turn.
Recovering from a provider context overflow
Add :context_overflow (candidate) on ExAgent.new/1 to compact and retry
automatically if a provider still rejects a request for exceeding its context
window:
agent = ExAgent.new(
model: %ExAgent.Models.Test{},
context_overflow: {ExAgent.Compaction.ClearToolResults, [threshold_tokens: 0, keep_recent: 0]}
)Retry and fall back to another model
Wrap primary and backup models in ExAgent.Models.Fallback so transient 429
or 5xx outages fail over transparently (set foreign_history: :portable on
cross-provider routes):
primary = ExAgent.Models.ReqLLM.new(Keyword.put(primary_options, :foreign_history, :portable))
backup = ExAgent.Models.ReqLLM.new(Keyword.put(backup_options, :foreign_history, :portable))
model = ExAgent.Models.Fallback.new(models: [primary, backup], max_retries: 2)
agent = ExAgent.new(model: model, tools: tools)Report the answering route
Inspect response.model_name across result.new_messages to report which
unique route answered each turn (keeping shared model names explicitly
:unknown until paired with transport-level receipts):
alias ExAgent.{Message.Response, Model}
routes = [{"primary", primary}, {"backup", backup}]
by_name = Enum.group_by(routes, fn {_, model} -> Model.model_name(model) end)
answers =
for %Response{model_name: name} <- result.new_messages do
case by_name[name] do
[{route, model}] -> %{route: route, provider: Model.system(model), model: name}
_ -> %{route: :unknown, model: name}
end
end
%{
answers: answers,
total_cents: result.cost_cents,
known_subtotal_cents: result.usage.accounting["cost"]["subtotal_cents"]
}Share a provider quota across runs
Supervise an ExAgent.RateLimiter to coordinate RPM, TPM and in-flight
concurrency across every agent sharing a provider account — preventing
thundering-herd 429 storms:
children = [
{ExAgent.RateLimiter,
name: MyApp.ModelQuota,
limits: %{"test" => [rpm: 60, tpm: 100_000, concurrency: 4]}}
]
{:ok, _supervisor} = Supervisor.start_link(children, strategy: :one_for_one)
agent = ExAgent.new(model: "test", rate_limiter: MyApp.ModelQuota,
model_settings: [max_tokens: 512])
{:ok, result} = ExAgent.run(agent, "Hello")Fall back after a confirmed quota refusal
Set fallback_on_quota_denial: true on ExAgent.Models.Fallback so a
confirmed local quota refusal routes immediately to a backup model instead of
waiting out a cooldown.
Share a provider quota across replicas
Back RateLimiter with ExAgent.RateLimiter.Postgres so multiple Phoenix or
Oban nodes enforce one shared provider quota across your cluster:
handle = ExAgent.RateLimiter.Postgres.new(MyApp.Repo, scope: "provider-account-1")
{ExAgent.RateLimiter,
name: MyApp.SharedQuota,
limits: %{"openai:gpt-4o-mini" => [rpm: 60, tpm: 100_000, concurrency: 4]},
shared: [adapter: {ExAgent.RateLimiter.Postgres, handle}, lease_ms: 120_000, timeout: 5_000]}Allocate a limiter per tenant
Register one ExAgent.RateLimiter per tenant under a DynamicSupervisor and
Registry ({:via, Registry, {MyApp.TenantQuotas, tenant_id}}) so one busy
customer never starves another.
Bound requests and tool calls
ExAgent.UsageLimits puts hard ceilings on requests, tool calls, tokens and
estimated spend for a run and all of its delegated children:
agent = ExAgent.new(
model: "test",
usage_limits: %ExAgent.UsageLimits{request_limit: 3, tool_calls_limit: 2}
)
{:ok, result} = ExAgent.run(agent, "Hello!")
result.request_count
# => 1Close before a run limit
Add ExAgent.UsageLimits.WrapUp so an agent approaching its request, token or
deadline cap gets one graceful final turn to synthesize what it already knows
instead of abruptly failing:
alias ExAgent.{UsageLimits, Models.Test}
alias ExAgent.UsageLimits.WrapUp
agent =
ExAgent.new(
model: %Test{label: "Here is what I found."},
usage_limits: %UsageLimits{request_limit: 1},
capabilities: [WrapUp.new(remaining_requests: 1)]
)
{:ok, result} = ExAgent.run(agent, "Summarize what you know.")
:request_limit = WrapUp.reason(result)For delegated multi-agent runs where a parent and child share the same
request_limit, pass WrapUp.new(remaining_requests: 2) so the parent keeps
enough room to summarize after its last child finishes.
Finish at the step limit
By default (on_max_steps: :error), hitting max_steps: fails cleanly and
retains every completed tool return in partial:
alias ExAgent.Message.Part.ToolCall
lookup = ExAgent.Tool.new(name: "lookup", call: fn _, _ -> "Found." end)
call = %ToolCall{tool_name: "lookup", tool_call_id: "lookup-1", args: %{}}
model = %ExAgent.Models.Test{script: [{:tool_calls, [call]}]}
agent = ExAgent.new(model: model, tools: [lookup], max_steps: 1)
{:error, %ExAgent.RunError{reason: {:max_steps_exceeded, 1}, partial: partial}} =
ExAgent.run(agent, "Look up the answer.")
partialSet on_max_steps: :final if you want the final step to disable function tools
and ask the model for a best-effort final answer instead.
Reserve a shared spend budget
For multi-tenant SaaS billing ceilings across runs and nodes, attach a
spend_budget: (candidate) backed by PostgreSQL (ExAgent.UsageLimits.Budget.Postgres)
or ETS. ExAgent reserves cents before requests and settles actual or estimated
spend automatically:
alias ExAgent.UsageLimits.Budget
alias ExAgent.UsageLimits.Budget.Postgres
account =
Postgres.new(MyApp.BudgetRepo,
scope: tenant_id,
limit_cents: 250,
window_ms: 86_400_000
)
budget = Budget.new(adapter: {Postgres, account}, reservation_cents: 2)
agent = ExAgent.new(model: model, spend_budget: budget)Price media and tools
Paid external tools (like search APIs or image generation) can declare
reservation_cents: and return {:ok, value, Usage.with_estimated_cost(nil, billed_cents)}
so tool charges settle against the same tenant spend budget.
Read the spend ledger
Inspect current held balance, settled spend and remaining window allowance from
your budget adapter (ExAgent.UsageLimits.Budget.balance/2) to power tenant
dashboards, quota alerts or approval review cards.
Track spend by tenant
Pass per-turn usage_limits: (candidate) (with accounting: :estimated and
max_budget_cents:) and an estimate_cost: function to
ExAgent.Server.send_message/3 to cap individual user turns inside a tenant's
overall budget.
Qualify usage in an adapter
ExAgent never pretends an unknown token count is 0. Custom model adapters
report exact or normalized usage with explicit availability and cost
provenance:
alias ExAgent.Message
alias ExAgent.Message.{Part, Usage}
usage = %Usage{
input_tokens: 120,
output_tokens: nil,
accounting: %{
"version" => 1,
"source" => "model",
"quality" => "normalized",
"provider_presence" => "unknown",
"input_semantics" => "unknown",
"reasoning_semantics" => "unknown",
"availability" => %{
"input" => "available",
"output" => "unavailable",
"cache_read" => "unavailable",
"cache_write" => "unavailable",
"reasoning" => "unavailable"
},
"cost" => %{
"source" => "estimator",
"quality" => "estimated",
"availability" => "partial",
"cents" => nil,
"subtotal_cents" => 0.25
}
}
}
reply = Message.new_response([%Part.Text{content: "Answer."}],
usage: usage,
finish_reason: :stop
)
agent = ExAgent.new(model: %ExAgent.Models.Test{script: [reply]})
{:ok, result} = ExAgent.run(agent, "Read the source.")
%{"availability" => coverage, "quality" => quality, "cost" => cost} = result.usage.accounting
%{
requests: result.request_count,
tokens: %{
quality: quality,
input: {result.usage.input_tokens, coverage["input"]},
output: {result.usage.output_tokens, coverage["output"]}
},
cost_cents: result.cost_cents,
known_subtotal_cents: cost["subtotal_cents"]
}Configuration errors and run failures
Invalid construction options (unknown keys, bad limits, invalid profiles) raise
ArgumentError eagerly before IO. Operational failures during a run — missing
credentials, HTTP errors, quota denials, step/usage exhaustion — return
{:error, %ExAgent.RunError{reason: reason, partial: partial}} so you can
inspect partial progress and handle retries explicitly. See
Diagnose an integration for a symptom lookup table.
API: ExAgent.Model, ExAgent.Models.ReqLLM, ExAgent.Models.Fallback,
ExAgent.UsageLimits, ExAgent.UsageLimits.Budget, ExAgent.RateLimiter,
ExAgent.Compaction, ExAgent.Media, ExAgent.Embeddings, ExAgent.Classifier.