Resolve Runtime • AI Agent SDK
resolve_runtime: Resolve runtime for the given agent and model at turn-time.
resolve_runtime
Function
</div>
This function is defined in the resolve module.
Resolve runtime for the given agent and model at turn-time.
This is the main API that handoffs and sub-agent invocations should call to get the appropriate runtime instead of using construction-time pins.
Signature
def resolve_runtime(agent_id: str, model_ref: str, session_ctx: SessionContext) -> AgentRuntimeProtocolParameters
ParamField
strUnique identifier for the agent
ParamField
strModel reference (e.g., ‘gpt-4o’, ‘claude-3-sonnet’)
ParamField
SessionContextSession context for caching and tracking
Returns
ResponseField
AgentRuntimeProtocolAgentRuntimeProtocol instance configured for the model
Exceptions
RuntimeError
If no suitable runtime can be resolved
Usage
session_ctx = SessionContext(
session_id="session_123",
timestamp=time.time(),
handoff_depth=1
)
runtime = resolve_runtime("agent_1", "gpt-4o", session_ctx)
response = runtime.execute("Hello, world!")Uses
time.timelogger.debuglogger.infoget_global_resolverresolver.supports_modelRuntimeErrorresolver.resolvelogger.error
Used By
Source
View on GitHubpraisonaiagents/runtime/resolve.py at line 232