Skip to main content
Runtime selection lets you pick which execution backend (Claude Code, Codex CLI, the built-in PraisonAI runtime) runs each model — declared on the model map, not the agent.
The user chooses a runtime backend for the agent; PraisonAI resolves CLI versus native execution for each model.

Quick Start

1

Simple Usage

2

With Configuration

How It Works

Resolution order (from RuntimeResolver):
  1. Per-model runtimemodel_runtime_configs[model_name]
  2. Per-provider defaultprovider_runtime_configs[provider_name]
  3. Auto-selectionresolve_runtime() picks the highest-priority runtime whose supports(model_ref) returns true; see Agent Runtime Protocol
  4. Built-in default"praisonai"
  5. Legacy cli_backend — emits DeprecationWarning
Provider is inferred from the model name by resolve_provider() (core SDK): an explicit provider/model prefix wins, then entry-point-registered matchers, then the built-ins below. Since PraisonAI PR #4651 every built-in provider resolves through providers.<name>.runtime_default, not just anthropic/openai/google.
Before PraisonAI PR #4651, only anthropic / openai / google resolved. A providers.groq.runtime_default (or any provider outside those three) was silently ignored — model-name → provider inference recognised just three vendors. Since #4651 all built-ins resolve, and third parties can register their own vendor via the praisonaiagents.model_providers entry-point group — see Model Provider Plugins.

Configuration

Agent parameter forms

Invalid types raise:

YAML — choose your level

AgentRuntimeConfig options

Helper methods: from_runtime_id(id, **kwargs), from_dict(d), to_dict(), merge_overrides(overrides), with_runtime(id), is_explicit().

Built-in runtime IDs

Reference IDs: "claude-code", "codex-cli", "grok-cli", "gemini-cli", "praisonai". Built-in default is "praisonai".
Subscription-backed runtimes. Use runtime="codex-cli", "grok-cli", "gemini-cli", or "claude-code" when you want to route turns through a CLI that owns its own subscription/OAuth session — no API key needed. See the CLI Backend Protocol.

Framework gate

Runtime features require an adapter whose SUPPORTS_RUNTIME_FEATURES = True (the built-in praisonai adapter has it). Frameworks without that flag raise:
Third-party adapters opt in by setting SUPPORTS_RUNTIME_FEATURES = True on their subclass — see Capability Flags.

Fail-closed behaviour

Unknown runtime IDs raise — they do not silently fall back:
Top-level RuntimeError from Agent:
If you typo a runtime ID, the agent fails at start. This is intentional — silent fallbacks should not ship to production.

Common Patterns

  1. One provider, one runtime everywhere — set providers.<name>.runtime_default for any built-in vendor (anthropic, openai, google, groq, cohere, mistral, ollama, deepseek, xai, perplexity), e.g. providers.groq.runtime_default: praisonai.
  2. Mix runtimes per modelmodels.claude-3-sonnet.runtime: claude-code plus models.gpt-4o.runtime: praisonai.
  3. Per-agent override — agent-level runtime beats model/provider config when one role needs different behaviour.

Migration from cli_backend

cli_backend still works but emits DeprecationWarning (slated for removal in 2.0.0).
For automatic YAML migration, run praisonai doctor fix --execute (or praisonai doctor runtime --fix --execute) — see Runtime Config Migration. Agent-level YAML warning:
YAML cli_backend: fail-closed rules (PR #4111). The wrapper adapter resolves cli_backend: into the cli_backend kwarg core Agent expects. Two paths now fail loudly instead of silently misrouting:
  • process: workflow rejects cli_backend: — the workflow engine runs agents natively:
  • Unresolvable backend ids fail closed during resolution:

Best Practices

Keep runtime choice with the model, not the role. Use models.<name>.runtime unless one agent truly needs an override.
providers.<name>.runtime_default makes adding new models painless — new models inherit the provider backend automatically.
Typo’d runtime IDs should fail at startup, not silently fall back to the built-in runtime.
Use the migration table above or praisonai doctor fix (the shorter equivalent of praisonai doctor runtime --fix) before 2.0.0 removes cli_backend.

Agent Runtime Protocol

Plugin harness registry, register_runtime, and praisonai.runtimes entry points

Runtime Preflight

Validate team YAML before AgentTeam.start()

Model Provider Plugins

Register custom model-name → provider matchers via entry points