Python API Reference¶
Complete Python API reference for StrataRouter Runtime.
CoreRuntimeBridge¶
from stratarouter_runtime import CoreRuntimeBridge, RuntimeConfig
bridge = CoreRuntimeBridge(
core_router=router,
runtime_config=config
)
Methods¶
execute()
get_metrics()
RuntimeConfig¶
class RuntimeConfig:
def __init__(
self,
execution_timeout: int = 60,
max_retries: int = 3,
cache_enabled: bool = True,
cache_backend: str = "redis",
batch_enabled: bool = True,
state_backend: str = "postgresql"
)
ExecutionResult¶
@dataclass
class ExecutionResult:
response: str
route_id: str
confidence: float
latency_ms: float
cost_usd: float
cache_hit: bool
provider_used: str
CacheManager¶
class CacheManager:
async def get(self, key: str) -> Optional[Any]
async def set(self, key: str, value: Any, ttl: int = 3600)
async def delete(self, key: str)
async def clear(self)
async def get_stats(self) -> CacheStats
BatchProcessor¶
class BatchProcessor:
async def process(
self,
requests: List[Dict],
timeout: Optional[int] = None
) -> List[Any]
StateManager¶
class StateManager:
async def save(self, execution_id: str, state_data: Dict)
async def load(self, execution_id: str) -> Dict
async def checkpoint(self, execution_id: str, step: int, state_data: Dict)
async def recover(self, execution_id: str) -> Dict