> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Resolve Runtime • AI Agent SDK

> resolve_runtime: Resolve runtime for the given agent and model at turn-time.

# resolve\_runtime

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**resolve**](../modules/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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def resolve_runtime(agent_id: str, model_ref: str, session_ctx: SessionContext) -> AgentRuntimeProtocol
```

## Parameters

<ParamField query="agent_id" type="str" required={true}>
  Unique identifier for the agent
</ParamField>

<ParamField query="model_ref" type="str" required={true}>
  Model reference (e.g., 'gpt-4o', 'claude-3-sonnet')
</ParamField>

<ParamField query="session_ctx" type="SessionContext" required={true}>
  Session context for caching and tracking
</ParamField>

### Returns

<ResponseField name="Returns" type="AgentRuntimeProtocol">
  AgentRuntimeProtocol instance configured for the model
</ResponseField>

### Exceptions

<AccordionGroup>
  <Accordion title="RuntimeError">
    If no suitable runtime can be resolved
  </Accordion>
</AccordionGroup>

## Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
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.time`
* `logger.debug`
* `logger.info`
* `get_global_resolver`
* `resolver.supports_model`
* `RuntimeError`
* `resolver.resolve`
* `logger.error`

## Used By

* [`is_runtime_available`](../functions/is_runtime_available)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/resolve.py#L232">
  `praisonaiagents/runtime/resolve.py` at line 232
</Card>
