Runtime Configuration

Declare which runtime capabilities your agent requires and control runtime selection and validation

Tell the agent framework exactly which runtime features you need — it validates compatibility before your agent runs.

python
from praisonaiagents import Agent
from praisonaiagents.config import RuntimeConfig

agent = Agent(
    name="StreamingAgent",
    instructions="You stream responses to users.",
    runtime=RuntimeConfig(
        required_capabilities={"native_hooks", "streaming_deltas"},
        preferred_runtime="native",
    )
)

agent.start("Tell me about AI")

The user sets runtime requirements on the agent; compatibility is checked before the first turn runs.

Diagram

Runtime Selection

Preferred\nAvailable

Fallback\nAllowed

No Match

🤖 Agent

🔍 Validate\nCapabilities

⭐ Preferred\nRuntime

🔄 Fallback\nRuntime

❌ Error

✅ Execute

Quick Start

  1. Declare Required Capabilities

    Specify what your agent needs — the framework validates this before execution:

    python
    from praisonaiagents import Agent
    from praisonaiagents.config import RuntimeConfig
    
    agent = Agent(
        name="HooksAgent",
        instructions="You use native hooks for monitoring.",
        runtime=RuntimeConfig(
            required_capabilities={"native_hooks", "tool_loop"},
        )
    )
    
    agent.start("Process this request")
  2. Prefer a Specific Runtime with Fallback

    Request a specific runtime but allow fallback if unavailable:

    python
    from praisonaiagents import Agent
    from praisonaiagents.config import RuntimeConfig
    
    agent = Agent(
        name="MCPAgent",
        instructions="You use MCP tools.",
        runtime=RuntimeConfig(
            preferred_runtime="native",
            required_capabilities={"mcp_tools"},
            fallback_allowed=True,       # Try other runtimes if "native" unavailable
            validate_on_creation=True,   # Fail fast at creation, not first run
        )
    )

Which Runtime Option Fits?

Pick the smallest option that expresses your requirement.

Diagram

Any runtime is fine

A specific runtime by name

Certain capabilities

Capabilities + fallback rules

Yes — fail if missing

No — degrade gracefully

What does your
agent require?

runtime=True

runtime=’native’

runtime=[‘native_hooks’, ‘mcp_tools’]

runtime=RuntimeConfig(…)

Must the preferred
runtime be used?

fallback_allowed=False

fallback_allowed=True


How It Works

Diagram
RuntimeRuntimeRegistryAgentUserRuntimeRuntimeRegistryAgentUseralt[Preferred runtimeavailable][Fallback allowed][No match +fallback_allowed=False]Create agent with RuntimeConfigCheck preferred_runtimeValidate required_capabilitiesUse preferred runtimeUse fallback runtimeRaise errorAgent readystart()ExecuteResponse

Configuration Options

RuntimeConfig SDK Reference

Full parameter reference for RuntimeConfig

Precedence ladder:

python
# Level 1: Bool (default runtime, no requirements)
agent = Agent(runtime=True)

# Level 2: String (preferred runtime name)
agent = Agent(runtime="native")

# Level 3: List (required capabilities)
agent = Agent(runtime=["native_hooks", "streaming_deltas"])

# Level 4: RuntimeConfig (full control)
agent = Agent(runtime=RuntimeConfig(
    required_capabilities={"native_hooks"},
    preferred_runtime="native",
    fallback_allowed=True,
))
OptionTypeDefaultDescription
required_capabilities`list \set \None`NoneCapabilities the agent must have
preferred_runtime`str \None`NonePreferred runtime implementation name
fallback_allowedboolTrueAllow fallback to other runtimes if preferred unavailable
validate_on_creationboolTrueValidate at agent creation (fail fast) vs. first execution
metadata`dict \None`{}Additional runtime hints

Common Patterns

Require streaming capability:

python
from praisonaiagents import Agent
from praisonaiagents.config import RuntimeConfig

agent = Agent(
    name="StreamBot",
    instructions="Stream responses character by character.",
    runtime=RuntimeConfig(
        required_capabilities={"streaming_deltas"},
        preferred_runtime="native",
    )
)

MCP-capable agent:

python
from praisonaiagents import Agent
from praisonaiagents.config import RuntimeConfig

agent = Agent(
    name="MCPAgent",
    instructions="Use MCP tools to complete tasks.",
    runtime=RuntimeConfig(
        required_capabilities={"mcp_tools", "tool_loop"},
        fallback_allowed=False,  # Fail if MCP isn't available
    )
)

Best Practices

Use validate_on_creation=True for production

Fail-fast validation (the default) catches capability mismatches immediately when the agent is created, not mid-execution. This prevents hard-to-debug runtime failures.

Set fallback_allowed=False for strict requirements

If your agent genuinely cannot function without a specific capability (e.g., MCP tools), set fallback_allowed=False. This gives a clear error instead of silently falling back to a degraded runtime.

Use the docs for available capability names

Check the Runtime Capabilities page for the list of valid capability names supported by each runtime.


Related