RuntimeResult deltas.
AgentRuntimeProtocol, resolve_runtime, register_runtime, and list_runtimes are importable directly from praisonaiagents as of PR #2335. The deep praisonaiagents.runtime.* paths remain available for backward compatibility.Quick Start
1
Run a turn with the built-in runtime
2
Stream the response
The built-in
praisonai runtime currently yields a single delta containing the full response. True token-by-token streaming is pending Agent-side support.3
Register and use a custom runtime
How It Works
The registry auto-discovers built-in and plugin runtimes, then hands back an instance implementingAgentRuntimeProtocol.
Picking a Runtime
Configuration Options
AgentRuntimeProtocol
Any object implementing these three methods is a valid runtime:
**kwargs understood by the built-in runtime: tools, max_tokens, temperature.
RuntimeConfig
RuntimeResult
RuntimeDelta
RuntimeRegistryEntry
RuntimeRegistry methods
Common Patterns
Implement a custom runtime
Plugin runtime via pyproject.toml
Ship your runtime as an installable package. The registry discovers it automatically at import time.Alias a runtime
Replace the default runtime
List available runtimes
Check if a runtime is available
Best Practices
Return errors, don't raise
Return errors, don't raise
The built-in runtime returns
RuntimeResult(error=...) instead of raising. Custom runtimes should follow the same pattern so callers can handle failure uniformly with a single if result.error: check.Use a factory for stateful runtimes
Use a factory for stateful runtimes
Pass
register_runtime("id", lambda: MyRuntime()) so each resolve_runtime call gets a fresh instance. This is important for runtimes that hold per-turn state or open connections.Emit typed deltas in stream_turn
Emit typed deltas in stream_turn
stream_turn yields RuntimeDeltas — emit type="text" for tokens, type="error" on failure, type="tool_call" or type="thinking" for richer UIs. Always end with an error delta rather than raising.Use registry.clear() only in tests
Use registry.clear() only in tests
The registry is process-wide and thread-safe. Call
RuntimeRegistry().clear() only in test teardown to avoid affecting other parts of your application.Related
Run the whole agent loop on remote provider infrastructure
Select runtimes by model or provider at the YAML level
Resolve and cache runtimes at turn time
Plug in tools from any Model Context Protocol server

