Runtime Glue Overview
1. Purpose
This document defines the L3 Runtime Glue specification layer for MPLP. Runtime Glue is the binding layer between:
- L2 Modules (Context, Plan, Trace, etc.)
- Protocol State Graph (PSG)
- Observability Events
- Learning Hooks
Key Principle: Runtime Glue is a specification layer, not an implementation. Concrete implementations belong in SDKs and products.
2. Scope
Specifications for:
- Read/write paths between L2 objects and PSG
- Event emission rules tied to PSG changes and pipeline stages
- Minimal drift detection behaviors (spec-level)
- Minimal rollback behaviors (spec-level)
- Crosscut concern bindings (coordination, error-handling, etc.)
Deliverables:
- Markdown documentation
- YAML matrices/configurations
- Pseudo-code examples (in docs)
3. Non-Goals
NOT included:
- Concrete runtime implementation details (framework, language)
- Storage engine choice for PSG (graph DB, document DB, file system)
- Full enterprise-grade rollback strategies (HA/DR, 2PC, saga patterns)
- Vendor-specific optimizations or extensions
- Actual executable code (
.ts,.py,.gofiles)
Reason: L3 is the specification layer, not implementation layer. Implementations belong in @mplp/reference-runtime, TracePilot, Coregentis, or other products.
4. Core Responsibilities
4.1 Normalize Inputs
Map L2 objects into PSG nodes and edges
Example: When a Plan object is created:
- Runtime reads
Plan.plan_id,Plan.context_id,Plan.steps[] - Creates PSG nodes:
psg.plans[plan_id]with metadatapsg.plan_steps[step_id]for each step
- Creates PSG edges:
psg.edges[context_id -> plan_id](context-to-plan binding)psg.edges[step_i -> step_j](dependency chains)
4.2 Maintain Graph Consistency
Use GraphUpdateEvent for every structural change
Conformance: REQUIRED (from Phase 3 - Observability Duties)
When PSG is modified:
- Determine
update_kind: node_add, node_update, node_delete, edge_add, edge_update, edge_delete, bulk - Compute
node_deltaandedge_delta - Emit
GraphUpdateEventwith:graph_id: PSG identifierupdate_kind,node_delta,edge_deltasource_module: Which L2 module triggered the update
4.3 Track Pipeline Execution
Use PipelineStageEvent for every pipeline stage transition
Conformance: REQUIRED (from Phase 3 - Observability Duties)
When a pipeline stage changes state:
- Identify
pipeline_id,stage_id,stage_name,stage_order - Determine
stage_status: pending → running → completed/failed/skipped - Emit
PipelineStageEventwith all fields
4.4 Expose Learning Hooks
Optionally produce LearningSamples based on key decisions
Conformance: RECOMMENDED (from Phase 4 - Learning Feedback Duties)
At recommended collection points:
- Identify sample family (intent_resolution, delta_impact, etc.)
- Extract
input,state,output,metafrom L2 objects and PSG - Create LearningSample conforming to schemas
- Store or stream to training pipeline
5. Relationship to Protocol Phases
| Phase | Contribution | Runtime Glue Integration |
|---|---|---|
| Phase 1: SA Profile | Single-agent execution semantics | Defines how SA steps → PSG trace nodes |
| Phase 2: MAP Profile | Multi-agent coordination semantics | Defines how MAP sessions → PSG collab nodes |
| Phase 3: Observability | Event taxonomy + emission obligations | Specifies WHEN to emit which events |
| Phase 4: Learning | LearningSample data formats | Specifies WHEN to collect which samples |
| Phase 5: Runtime Glue | Unifies all above into PSG-centric model | You are here |
6. Crosscut Bindings (Summary)
See Crosscut PSG Event Binding for complete bindings.
MPLP's 9 Crosscuts:
- coordination: Collab sessions, MAP events
- error-handling: Failure nodes, PipelineStageEvent (failed)
- event-bus: All Observability events
- orchestration: Pipeline control, PipelineStageEvent
- performance: Timing metrics, CostAndBudgetEvent
- protocol-version: PSG version annotations
- security: Access control in PSG
- state-sync: PSG as sync target, GraphUpdateEvent
- transaction: Batch updates, GraphUpdateEvent (bulk)
7. Conformance Requirements
7.1 MUST Requirements (v1.0)
Runtime implementations claiming "MPLP v1.0 conformant" MUST:
- Document their ModulePSG mapping (which PSG areas each module touches)
- Emit
GraphUpdateEventfor all PSG structural changes - Emit
PipelineStageEventfor all pipeline stage transitions - Use PSG as single source of truth (not scattered caches)
7.2 SHOULD Requirements (v1.0)
Runtime implementations SHOULD:
- Implement minimal drift detection (compare PSG snapshots)
- Support basic rollback (restore PSG snapshot)
- Emit RuntimeExecutionEvent for agent/tool/LLM calls
- Collect LearningSamples at recommended triggers
7.3 NOT Required for v1.0
- Specific PSG storage engine
- Enterprise-grade HA/DR
- ML-based drift prediction
- Saga/2PC transaction patterns
8. Related Documents
- Module PSG Paths
- Crosscut PSG Event Binding
- PSG Overview
- Action Execution Layer
- Value State Layer
- Drift and Rollback
Layer: L3 (Specification)
Key Events: GraphUpdateEvent (REQUIRED), PipelineStageEvent (REQUIRED)
Runtime Glue establishes the specification layer for how MPLP protocol elements are realized through PSG-centric runtime implementations, ensuring consistency and interoperability across vendors while maintaining extensibility.