services.runtime_lifecycle
Shared runtime lifecycle helpers.
This module centralizes runtime teardown behavior so invokers and routes can reuse the same logic.
terminate_runtime_prefer_core
async def terminate_runtime_prefer_core(runtime_id: str, runtime_base_url: str,
token: str | None) -> bool
Terminate a runtime, preferring datalayer-core then API fallback.
Returns True when a termination request was issued successfully.
terminate_runtime_and_local_agent
async def terminate_runtime_and_local_agent(
agent_id: str,
runtime_id: str,
runtime_base_url: str,
token: str | None,
local_server_base_url: str = "http://127.0.0.1:8765") -> None
Terminate a runtime and remove local agent registration.
- Delete the local agent registration.
- Prefer datalayer-core runtime termination.
- Fallback to direct runtime API deletion.