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
run_turn()
Execute a single turn using the prepared context.
supports_runtime_mode()Check if this runtime supports the given execution mode.
get_supported_modes()Get all runtime modes supported by this implementation.
Usage
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 GitHubpraisonaiagents/runtime/protocols.py at line 32