agent.run()
DOCUMENTATION / PLATFORM GUIDES

Based on AgentRun release · Synced .

Models and API keys

AgentRun runs with your model credentials. Choose the provider in the console, then select a model that your chosen harness can use.

Add a provider key

Open Settings → Tool keys → Model keys and save the key for your provider. The change applies without restarting the server. The launcher also reads keys already set in its environment.

Provider Environment variable Starting point
OpenRouter OPENROUTER_API_KEY A capped key gives you access to multiple model families. Start with Pi and the server's available default.
Anthropic ANTHROPIC_API_KEY Use an Anthropic model, including the native Claude Code harness configuration.
OpenAI OPENAI_API_KEY Use an OpenAI model, including the native Codex harness configuration.

A Claude Code, Codex, or other coding-app login is separate from the credentials of the AgentRun server. Keep keys in the console or your secret manager; never include them in agent instructions, source control, or chat.

Choose a model

An agent definition can set model to provider/model-id. With no model on the definition, it uses the server default. Set AGENT_MODEL when starting the server to choose that default explicitly.

With no explicit default, the server chooses from configured providers. Inspect GET /v2/capabilities rather than assuming which key or model won:

Field Meaning
models.default The configured default model.
models.ready Whether a revision using the default can run.
models.needs Whether configuration is missing a key or a recognized model.
models.priced Whether the server can estimate the default model's cost for a capped run.
harnesses Installed harnesses, availability, and reasons for missing setup.

The capability fields described here follow current repository source. An older installed server may expose fewer fields; its returned schema is authoritative.

Gateways and workflow decisions

For an OpenAI Responses-compatible gateway, the server supports AGENT_MODEL_BASE_URL, AGENT_MODEL_API_KEY, and AGENT_MODEL. Gateway model IDs, harness routing, and pricing need to match that gateway. Use the models reference before configuring one.

Workflow model nodes can use fast, default, and strong tiers. AGENT_MODEL_FAST and AGENT_MODEL_STRONG override those tiers. Typed decision nodes may use an OpenRouter-backed decision model or a separate decision provider such as Jev, depending on configuration. A plain agent task does not require Jev. See Decision workflows only when your workflow uses them.

Control spend

Use a provider-side credit limit and set a run's max_cost_usd. An agent definition can supply a default cap; a run-specific cap overrides it. Caps depend on the server's pricing data and accounting mode, so they are not a substitute for the provider's billing limit.

An unknown price is not zero cost. A capped run using an unpriced model can be refused before it starts; configure the gateway price or use a priced model. For a paused run, inspect its pending budget decision in the console before continuing.

See Spend cap for accounting modes, learning costs, and continuation behavior.