> ## 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

Function

> This function is defined in the [**resolve**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/resolve.md) 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

**agent\_id** `str` *required*

Unique identifier for the agent

**model\_ref** `str` *required*

Model reference (e.g., 'gpt-4o', 'claude-3-sonnet')

**session\_ctx** `SessionContext` *required*

Session context for caching and tracking

### Returns

**Returns** `AgentRuntimeProtocol`

AgentRuntimeProtocol instance configured for the model

### Exceptions

> [accordion] RuntimeError
>
> If no suitable runtime can be resolved

## 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] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/runtime/resolve.py#L232)
>
> `praisonaiagents/runtime/resolve.py` at line 232


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.