Skip to content

symfonic.kernel.result_runtime

result_runtime

Invocation-owned result storage and opaque authority for run-aware tools.

ResultRuntime

ResultRuntime(run_id: str, scope_path: str, *, ledger: object = None)

Private ledger that exists for exactly one invocation.

Source code in src/symfonic/kernel/result_runtime.py
def __init__(self, run_id: str, scope_path: str, *, ledger: object = None) -> None:
    if not run_id or type(scope_path) is not str:
        raise ContractViolationError("result runtime needs a run ID and canonical scope")
    self.run_id = run_id
    self.scope_path = scope_path
    self.ledger = ledger
    self._entries: dict[str, str] = {}
    self._seal = object()
    self._closed = False

put

put(handle: str, content: str) -> None

Reserve a run-local handle; future compaction owns handle generation.

Source code in src/symfonic/kernel/result_runtime.py
def put(self, handle: str, content: str) -> None:
    """Reserve a run-local handle; future compaction owns handle generation."""
    self.require_live()
    if not handle or handle in self._entries:
        raise ContractViolationError("result handle must be new within the invocation")
    self._entries[handle] = content

RunToolContext dataclass

RunToolContext(runtime: ResultRuntime, run_id: str, scope_path: str, _seal: object = None)

Opaque kernel-to-tool authority; never derived from model arguments.