Turn Runtime Protocol • AI Agent SDK

TurnRuntimeProtocol: Protocol for turn-based runtime execution.

TurnRuntimeProtocol

Defined in the protocols module.

AI Agent

Protocol for turn-based runtime execution.

This protocol defines the interface that runtimes must implement to execute prepared turn contexts. It standardizes the execution contract across different runtime types (native, plugin, managed, etc.).

Methods

Usage

python
class MyRuntime:
        async def run_turn(self, context: PreparedTurnContext) -> str:
            # Execute the turn using the prepared context
            return "response"

    # Use with prepared context
    context = PreparedTurnContext(...)
    runtime = MyRuntime()
    result = await runtime.run_turn(context)

Source

View on GitHub

praisonaiagents/runtime/protocols.py at line 32