Runtime Layer

The raes_runtime package owns live runtime control: runtime targets, backend registry integration, manager lifecycle execution, control-plane submission and observation, operation persistence, security, and backend result-contract validation helpers.

Runtime APIs consume neutral DTOs from raes_contracts at backend and control-plane boundaries. Header-based control-plane identity is disabled by default and requires an explicit ControlPlaneSecurityConfig with trust_proxy_identity_headers=True.

Public API

Live runtime control surfaces for RAES SDL.

class raes_runtime.BackendRegistry

Bases: object

Registry of runtime target descriptors.

__init__()
Return type:

None

register(name, manifest_factory, components_factory)
Parameters:
  • name (str)

  • manifest_factory (Callable[[...], BackendManifest])

  • components_factory (Callable[[...], RuntimeTargetComponents])

Return type:

None

describe(name)
Parameters:

name (str)

Return type:

RuntimeTargetDescriptor

manifest(name, **config)
Parameters:
  • name (str)

  • config (Any)

Return type:

BackendManifest

create(name, **config)
Parameters:
  • name (str)

  • config (Any)

Return type:

RuntimeTarget

list_backends()
Return type:

list[str]

is_registered(name)
Parameters:

name (str)

Return type:

bool

class raes_runtime.RuntimeControlPlane

Bases: WorkflowControlMixin, ParticipantControlMixin, ParticipantRetrievalMixin

Reference control plane for async runtime submission and observation.

__init__(target, *, initial_snapshot=None, store=None, behavior_specifications=None, crossing_policy_resolver=None)
Parameters:
Return type:

None

property snapshot: RuntimeSnapshot
property target_name: str
audit_log()
Return type:

list[AuditEvent]

operational_apparatus_summary()

Return a compact operational view over existing control-plane carriers.

Return type:

dict[str, object]

submit_provisioning(plan, *, base_snapshot=None, idempotency_key='', request_fingerprint='')
Parameters:
Return type:

OperationReceipt

submit_orchestration(plan, *, base_snapshot=None, idempotency_key='', request_fingerprint='')
Parameters:
Return type:

OperationReceipt

submit_evaluation(plan, *, base_snapshot=None, idempotency_key='', request_fingerprint='')
Parameters:
Return type:

OperationReceipt

get_operation(operation_id)
Parameters:

operation_id (str)

Return type:

OperationStatus | None

get_snapshot()
Return type:

RuntimeSnapshotEnvelope

record_audit(*, action, identity, allowed, target, reason='', operation_id='', details=None)
Parameters:
  • action (str)

  • identity (str)

  • allowed (bool)

  • target (str)

  • reason (str)

  • operation_id (str)

  • details (dict[str, object] | None)

Return type:

None

class raes_runtime.RuntimeFactActionDisposition

Bases: str, Enum

Aggregate action-dispatch outcome across all compiled sinks.

BOUND = 'bound'
BLOCKED = 'blocked'
FAILED = 'failed'
INAPPLICABLE = 'inapplicable'
__new__(value)
class raes_runtime.RuntimeFactBindingAdmission

Bases: object

Trusted control-plane authorization for one action instance.

run_id: str
participant_address: str
episode_id: str
workflow_address: str | None
action_instance_id: str
action_contract_address: str
requested_at: str
authority_refs: frozenset[str]
selections: tuple[RuntimeFactBindingSelectionModel, ...]
property action_key: tuple[str, str, str, str | None, str, str]

Return the exact admitted action context.

__init__(run_id, participant_address, episode_id, workflow_address, action_instance_id, action_contract_address, requested_at, authority_refs, selections)
Parameters:
  • run_id (str)

  • participant_address (str)

  • episode_id (str)

  • workflow_address (str | None)

  • action_instance_id (str)

  • action_contract_address (str)

  • requested_at (str)

  • authority_refs (frozenset[str])

  • selections (tuple[RuntimeFactBindingSelectionModel, ...])

Return type:

None

class raes_runtime.RuntimeFactBindingPlane

Bases: object

Append-only fact plane whose dispatch policy comes from trusted admission.

__init__(*, admissions=(), action_dispatcher=None, supported_source_kinds=None)
Parameters:
Return type:

None

declare(declaration)
Parameters:

declaration (RuntimeFactDeclarationModel)

Return type:

None

append(version)
Parameters:

version (RuntimeFactVersionModel)

Return type:

None

history(fact_id)
Parameters:

fact_id (str)

Return type:

tuple[RuntimeFactVersionModel, …]

bind_action_inputs(request)
Parameters:

request (RuntimeFactBindingRequestModel)

Return type:

RuntimeFactBindingResult

binding_history()
Return type:

tuple[RuntimeFactBindingEventModel, …]

project_for_participant(*, run_id, participant_address, episode_id)
Parameters:
  • run_id (str)

  • participant_address (str)

  • episode_id (str)

Return type:

tuple[RuntimeFactProjectionModel, …]

project_for_workflow(*, run_id, workflow_address)
Parameters:
  • run_id (str)

  • workflow_address (str)

Return type:

tuple[RuntimeFactProjectionModel, …]

class raes_runtime.RuntimeFactBindingResult

Bases: object

Value-free portable outcome and binding evidence.

accepted: bool
action_disposition: RuntimeFactActionDisposition
events: tuple[RuntimeFactBindingEventModel, ...]
diagnostics: tuple[Diagnostic, ...]
__init__(accepted, action_disposition, events, diagnostics)
Parameters:
Return type:

None

class raes_runtime.RuntimeFactDispatchCommand

Bases: object

One-shot command delivered only to the trusted action dispatcher.

__init__(bindings)
Parameters:

bindings (tuple[_RuntimeFactDispatchBinding, ...])

Return type:

None

property completed: bool

Report whether the trusted adapter consumed the command.

dispatch(*, send, secret_resolver=None)

Resolve protected references and synchronously deliver action inputs.

Parameters:
  • send (Callable[[Mapping[str, object]], None])

  • secret_resolver (Callable[[str], object] | None)

Return type:

None

class raes_runtime.RuntimeManager

Bases: RuntimeParticipantExecutionMixin, RuntimeTimeControlMixin

Plans and executes SDL runtime work against a target.

__init__(target, *, initial_snapshot=None, stochastic_controls=())
Parameters:
Return type:

None

property snapshot: RuntimeSnapshot
plan(scenario, snapshot=None, *, parameters=None, profile=None, artifact_availability=None)
Parameters:
  • scenario (object)

  • snapshot (RuntimeSnapshot | None)

  • parameters (dict[str, object] | None)

  • profile (str | None)

  • artifact_availability (ArtifactAvailabilityContext | None)

Return type:

ExecutionPlan

apply(execution_plan)
Parameters:

execution_plan (ExecutionPlan)

Return type:

ApplyResult

status()
Return type:

dict[str, object]

destroy()
Return type:

ApplyResult

class raes_runtime.RuntimeTarget

Bases: object

A fully configured runtime target.

name: str
manifest: BackendManifest
provisioner: Provisioner
orchestrator: Orchestrator | None = None
evaluator: Evaluator | None = None
participant_runtime: ParticipantRuntime | None = None
time_runtime: TimeRuntime | None = None
__init__(name, manifest, provisioner, orchestrator=None, evaluator=None, participant_runtime=None, time_runtime=None)
Parameters:
  • name (str)

  • manifest (BackendManifest)

  • provisioner (Provisioner)

  • orchestrator (Orchestrator | None)

  • evaluator (Evaluator | None)

  • participant_runtime (ParticipantRuntime | None)

  • time_runtime (TimeRuntime | None)

Return type:

None

class raes_runtime.RuntimeTargetComponents

Bases: object

Instantiated runtime target components without a manifest.

provisioner: Provisioner
orchestrator: Orchestrator | None = None
evaluator: Evaluator | None = None
participant_runtime: ParticipantRuntime | None = None
time_runtime: TimeRuntime | None = None
__init__(provisioner, orchestrator=None, evaluator=None, participant_runtime=None, time_runtime=None)
Parameters:
  • provisioner (Provisioner)

  • orchestrator (Orchestrator | None)

  • evaluator (Evaluator | None)

  • participant_runtime (ParticipantRuntime | None)

  • time_runtime (TimeRuntime | None)

Return type:

None

class raes_runtime.RuntimeTargetDescriptor

Bases: object

Factories for manifest introspection and target creation.

name: str
manifest_factory: Callable[[...], BackendManifest]
components_factory: Callable[[...], RuntimeTargetComponents]
__init__(name, manifest_factory, components_factory)
Parameters:
  • name (str)

  • manifest_factory (Callable[[...], BackendManifest])

  • components_factory (Callable[[...], RuntimeTargetComponents])

Return type:

None

Runtime Manager

Runtime manager for compiled SDL runtime plans.

class raes_runtime.manager.RuntimeManager

Bases: RuntimeParticipantExecutionMixin, RuntimeTimeControlMixin

Plans and executes SDL runtime work against a target.

__init__(target, *, initial_snapshot=None, stochastic_controls=())
Parameters:
Return type:

None

property snapshot: RuntimeSnapshot
plan(scenario, snapshot=None, *, parameters=None, profile=None, artifact_availability=None)
Parameters:
  • scenario (object)

  • snapshot (RuntimeSnapshot | None)

  • parameters (dict[str, object] | None)

  • profile (str | None)

  • artifact_availability (ArtifactAvailabilityContext | None)

Return type:

ExecutionPlan

apply(execution_plan)
Parameters:

execution_plan (ExecutionPlan)

Return type:

ApplyResult

status()
Return type:

dict[str, object]

destroy()
Return type:

ApplyResult

Backend Registry

Registry for runtime targets.

class raes_runtime.registry.RuntimeTarget

Bases: object

A fully configured runtime target.

name: str
manifest: BackendManifest
provisioner: Provisioner
orchestrator: Orchestrator | None = None
evaluator: Evaluator | None = None
participant_runtime: ParticipantRuntime | None = None
time_runtime: TimeRuntime | None = None
__init__(name, manifest, provisioner, orchestrator=None, evaluator=None, participant_runtime=None, time_runtime=None)
Parameters:
  • name (str)

  • manifest (BackendManifest)

  • provisioner (Provisioner)

  • orchestrator (Orchestrator | None)

  • evaluator (Evaluator | None)

  • participant_runtime (ParticipantRuntime | None)

  • time_runtime (TimeRuntime | None)

Return type:

None

class raes_runtime.registry.RuntimeTargetComponents

Bases: object

Instantiated runtime target components without a manifest.

provisioner: Provisioner
orchestrator: Orchestrator | None = None
evaluator: Evaluator | None = None
participant_runtime: ParticipantRuntime | None = None
time_runtime: TimeRuntime | None = None
__init__(provisioner, orchestrator=None, evaluator=None, participant_runtime=None, time_runtime=None)
Parameters:
  • provisioner (Provisioner)

  • orchestrator (Orchestrator | None)

  • evaluator (Evaluator | None)

  • participant_runtime (ParticipantRuntime | None)

  • time_runtime (TimeRuntime | None)

Return type:

None

class raes_runtime.registry.RuntimeTargetDescriptor

Bases: object

Factories for manifest introspection and target creation.

name: str
manifest_factory: Callable[[...], BackendManifest]
components_factory: Callable[[...], RuntimeTargetComponents]
__init__(name, manifest_factory, components_factory)
Parameters:
  • name (str)

  • manifest_factory (Callable[[...], BackendManifest])

  • components_factory (Callable[[...], RuntimeTargetComponents])

Return type:

None

class raes_runtime.registry.BackendRegistry

Bases: object

Registry of runtime target descriptors.

__init__()
Return type:

None

register(name, manifest_factory, components_factory)
Parameters:
  • name (str)

  • manifest_factory (Callable[[...], BackendManifest])

  • components_factory (Callable[[...], RuntimeTargetComponents])

Return type:

None

describe(name)
Parameters:

name (str)

Return type:

RuntimeTargetDescriptor

manifest(name, **config)
Parameters:
  • name (str)

  • config (Any)

Return type:

BackendManifest

create(name, **config)
Parameters:
  • name (str)

  • config (Any)

Return type:

RuntimeTarget

list_backends()
Return type:

list[str]

is_registered(name)
Parameters:

name (str)

Return type:

bool

Control Plane

Reference async-style control plane over runtime targets.

This is a repo-owned, schema-oriented façade that exposes runtime execution as submitted operations over plain-data-compatible envelopes. The current implementation completes operations eagerly, but the contract surface matches an async control plane so non-Python runtimes can evolve behind the same API.

class raes_runtime.control_plane.RuntimeControlPlane

Bases: WorkflowControlMixin, ParticipantControlMixin, ParticipantRetrievalMixin

Reference control plane for async runtime submission and observation.

__init__(target, *, initial_snapshot=None, store=None, behavior_specifications=None, crossing_policy_resolver=None)
Parameters:
Return type:

None

property snapshot: RuntimeSnapshot
property target_name: str
audit_log()
Return type:

list[AuditEvent]

operational_apparatus_summary()

Return a compact operational view over existing control-plane carriers.

Return type:

dict[str, object]

submit_provisioning(plan, *, base_snapshot=None, idempotency_key='', request_fingerprint='')
Parameters:
Return type:

OperationReceipt

submit_orchestration(plan, *, base_snapshot=None, idempotency_key='', request_fingerprint='')
Parameters:
Return type:

OperationReceipt

submit_evaluation(plan, *, base_snapshot=None, idempotency_key='', request_fingerprint='')
Parameters:
Return type:

OperationReceipt

get_operation(operation_id)
Parameters:

operation_id (str)

Return type:

OperationStatus | None

get_snapshot()
Return type:

RuntimeSnapshotEnvelope

record_audit(*, action, identity, allowed, target, reason='', operation_id='', details=None)
Parameters:
  • action (str)

  • identity (str)

  • allowed (bool)

  • target (str)

  • reason (str)

  • operation_id (str)

  • details (dict[str, object] | None)

Return type:

None

Control Plane API

Reference HTTP/JSON adapter for the runtime control plane.

raes_runtime.control_plane_api.create_control_plane_app(control_plane, *, security=None)

Create a reference HTTP/JSON control-plane app.

Parameters:
Return type:

FastAPI

Control Plane Store

Durable storage for the per-target runtime control plane.

class raes_runtime.control_plane_store.AuditEvent

Bases: object

Append-only security and control-plane audit event.

timestamp: str
action: str
identity: str
allowed: bool
target: str
operation_id: str = ''
reason: str = ''
details: dict[str, Any]
__init__(timestamp, action, identity, allowed, target, operation_id='', reason='', details=<factory>)
Parameters:
  • timestamp (str)

  • action (str)

  • identity (str)

  • allowed (bool)

  • target (str)

  • operation_id (str)

  • reason (str)

  • details (dict[str, Any])

Return type:

None

class raes_runtime.control_plane_store.ControlPlaneOperationRecord

Bases: object

Persisted receipt/status pair for one operation.

receipt: OperationReceipt
status: OperationStatus
request_fingerprint: str = ''
idempotency_key: str = ''
result_payload: dict[str, Any] | None = None
decision_history_heads: dict[str, str | None]
result_history_heads: dict[str, str | None]
__init__(receipt, status, request_fingerprint='', idempotency_key='', result_payload=None, decision_history_heads=<factory>, result_history_heads=<factory>)
Parameters:
  • receipt (OperationReceipt)

  • status (OperationStatus)

  • request_fingerprint (str)

  • idempotency_key (str)

  • result_payload (dict[str, Any] | None)

  • decision_history_heads (dict[str, str | None])

  • result_history_heads (dict[str, str | None])

Return type:

None

class raes_runtime.control_plane_store.ControlPlaneStore

Bases: Protocol

Durable persistence for control-plane state.

load_snapshot()
Return type:

RuntimeSnapshot

save_snapshot(snapshot)
Parameters:

snapshot (RuntimeSnapshot)

Return type:

None

load_records()
Return type:

dict[str, ControlPlaneOperationRecord]

save_record(record)
Parameters:

record (ControlPlaneOperationRecord)

Return type:

None

find_by_idempotency(key)
Parameters:

key (str)

Return type:

ControlPlaneOperationRecord | None

append_audit(event)
Parameters:

event (AuditEvent)

Return type:

None

read_audit()
Return type:

list[AuditEvent]

commit_control_transition(*, participant_address, expected_head, snapshot, record, audit_event)
Parameters:
Return type:

None

commit_participant_transition(*, expected_history_heads, snapshot, record, audit_event)
Parameters:
Return type:

None

__init__(*args, **kwargs)
class raes_runtime.control_plane_store.InMemoryControlPlaneStore

Bases: object

Simple in-memory store.

__init__(snapshot=None)
Parameters:

snapshot (RuntimeSnapshot | None)

Return type:

None

load_snapshot()
Return type:

RuntimeSnapshot

save_snapshot(snapshot)
Parameters:

snapshot (RuntimeSnapshot)

Return type:

None

load_records()
Return type:

dict[str, ControlPlaneOperationRecord]

save_record(record)
Parameters:

record (ControlPlaneOperationRecord)

Return type:

None

find_by_idempotency(key)
Parameters:

key (str)

Return type:

ControlPlaneOperationRecord | None

append_audit(event)
Parameters:

event (AuditEvent)

Return type:

None

read_audit()
Return type:

list[AuditEvent]

commit_control_transition(*, participant_address, expected_head, snapshot, record, audit_event)
Parameters:
Return type:

None

commit_participant_transition(*, expected_history_heads, snapshot, record, audit_event)
Parameters:
Return type:

None

class raes_runtime.control_plane_store.ParticipantCrossingHistoryPresence

Bases: str, Enum

Source-level API-423 history presence before snapshot defaults apply.

ABSENT = 'absent'
PRESENT_EMPTY = 'present-empty'
PRESENT = 'present'
__new__(value)
raes_runtime.control_plane_store.participant_crossing_history_presence(payload)

Classify raw runtime-snapshot input without inventing historical meaning.

Parameters:

payload (dict[str, Any])

Return type:

ParticipantCrossingHistoryPresence

Control Plane Security

Security policy for the per-target runtime control plane.

class raes_runtime.control_plane_security.ControlPlaneRole

Bases: str, Enum

Authorization roles for control-plane callers.

BACKEND = 'backend'
OPERATOR = 'operator'
AUDITOR = 'auditor'
__new__(value)
class raes_runtime.control_plane_security.ParticipantControlSubjectBinding

Bases: object

One authenticated principal-to-participant/controller binding.

participant_address: str
controller_ref: str
__init__(participant_address, controller_ref)
Parameters:
  • participant_address (str)

  • controller_ref (str)

Return type:

None

class raes_runtime.control_plane_security.ParticipantAudienceSubjectBinding

Bases: object

One authenticated principal-to-participant/audience binding.

participant_address: str
audience_scope_ref: str
__init__(participant_address, audience_scope_ref)
Parameters:
  • participant_address (str)

  • audience_scope_ref (str)

Return type:

None

class raes_runtime.control_plane_security.ControlPlaneIdentity

Bases: object

Authenticated control-plane principal.

identity: str
roles: frozenset[ControlPlaneRole]
target_name: str | None = None
participant_control_subjects: tuple[ParticipantControlSubjectBinding, ...] = ()
participant_audience_subjects: tuple[ParticipantAudienceSubjectBinding, ...] = ()
__init__(identity, roles=<factory>, target_name=None, participant_control_subjects=(), participant_audience_subjects=())
Parameters:
Return type:

None

class raes_runtime.control_plane_security.ControlPlaneSecurityConfig

Bases: object

Reference security settings for the HTTP/JSON control-plane adapter.

Header identities are only trustworthy behind an authenticated proxy that strips caller-supplied identity headers before setting its own values.

require_verified_identity: bool = True
verified_header: str = 'x-raes-client-verified'
identity_header: str = 'x-raes-client-identity'
trust_proxy_identity_headers: bool = False
max_request_bytes: int = 1000000
trusted_identities: dict[str, ControlPlaneIdentity]
bearer_tokens: dict[str, ControlPlaneIdentity]
classmethod strict_defaults()

Return fail-closed defaults with no built-in principals or tokens.

Return type:

ControlPlaneSecurityConfig

__init__(require_verified_identity=True, verified_header='x-raes-client-verified', identity_header='x-raes-client-identity', trust_proxy_identity_headers=False, max_request_bytes=1000000, trusted_identities=<factory>, bearer_tokens=<factory>)
Parameters:
  • require_verified_identity (bool)

  • verified_header (str)

  • identity_header (str)

  • trust_proxy_identity_headers (bool)

  • max_request_bytes (int)

  • trusted_identities (dict[str, ControlPlaneIdentity])

  • bearer_tokens (dict[str, ControlPlaneIdentity])

Return type:

None

Result Contracts

Public runtime result-contract validation helpers.

raes_runtime.result_contracts.evaluation_result_contract_diagnostics(snapshot)
Parameters:

snapshot (RuntimeSnapshot)

Return type:

list[Diagnostic]

raes_runtime.result_contracts.participant_episode_contract_diagnostics(snapshot)

Validate participant-episode snapshot data against RUN-311 invariants.

Delegates to iter_participant_episode_snapshot_violations so the manager apply path and the conformance semantic-check path share one source of truth for every invariant, and wraps each violation in a runtime.backend-contract-invalid diagnostic.

Parameters:

snapshot (RuntimeSnapshot)

Return type:

list[Diagnostic]

raes_runtime.result_contracts.participant_runtime_history_transition_diagnostics(previous_snapshot, next_snapshot)

Validate append-only participant history preservation across an apply.

Parameters:
Return type:

list[Diagnostic]

raes_runtime.result_contracts.participant_runtime_state_contract_diagnostics(snapshot)

Validate RUN-305 participant state/history snapshot data.

This combines the RUN-311 episode chain invariants with the RUN-305 behavior-history snapshot integrity checks so backend apply results cannot persist participant histories whose public map shape, identity keys, event types, episode references, or metadata boundary are invalid.

Parameters:

snapshot (RuntimeSnapshot)

Return type:

list[Diagnostic]

raes_runtime.result_contracts.proposition_truth_contract_diagnostics(snapshot)

Return fail-closed diagnostics for all truth results in a snapshot.

Parameters:

snapshot (RuntimeSnapshot)

Return type:

list[Diagnostic]

raes_runtime.result_contracts.workflow_result_contract_diagnostics(snapshot)
Parameters:

snapshot (RuntimeSnapshot)

Return type:

list[Diagnostic]