Loop Engine Architecture & Slots

System Flexible Graph Design: Wrapping Open-Source Repositories Behind Typed Swappable Engine Slots

By Taylor Amarel · 2026-10-18 · 10 min read (1276 words)
TYPED ENGINE SLOT + 7-LAYER COMPONENT ENVELOPE (HOT-SWAPPABLE EXTERNAL & NATIVE ENGINES) FIXED TYPED EDGE (< 2 KB CARD) Slot: physics_solver_3d v1.2 Layer 1: Typed Input/Output Layer 2: Pre/Post Invariants Layer 3: Effect Authority Scope Layer 4: Resource/Latency Budget Layer 5: Conformance Kit Suite Layer 6: Provenance & License Layer 7: Telemetry & Fallback SWAPPABLE ENGINE ADAPTERS Engine A: GitHub Repo Adapter Pinned SHA + MIT/Apache2 + Sandbox Engine B: Baltor Native Engine Zero-dep implementation passing kit Engine C: Custom Variation Selected at runtime by evidence SOLUTION GRAPH EXECUTION Every executable vertex is a Loop. Callers never import engine internals directly. 0 Caller Changes on Swap 100% Conformance Kit Gate Explore: compare.baltor.ai/systems

Modern software teams face a recurring dilemma when building AI-assisted systems. If an agent generates every functional module from scratch on each prompt, the system pays high token latency, loses deterministic guarantees, and regresses on edge cases that open-source libraries solved years ago. Conversely, if an agent glues together arbitrary third-party GitHub repositories with direct imports across the codebase, a single upstream breaking change, license incompatibility, or missing runtime binary breaks the entire pipeline. In Loop Engine (baltor.ai and getagentfoundry.si), we solve this through System Flexible Graph Design: every functional unit sits behind a fixed, typed, versioned contract edge with swappable engines registered in engine_slots.yaml.

This architecture enforces a strict separation between what a functional boundary guarantees and which engine executes it at runtime. Whether a slot is backed by a containerized GitHub repository adapter, a zero-dependency Baltor-native engine, or a hardware-accelerated variation, callers communicate exclusively through the typed edge.

One Loop Runtime and the Fixed Contract Edge

A foundational rule in Loop Engine is that Loop is the only executable graph vertex. Practitioner, Intelligence, and Solution are roles; deterministic, hybrid, and non-deterministic are execution modes. We never introduce ad-hoc Node subclasses for third-party tools. Instead, a discrete cognitive or act step Loop node executes its narrowly scoped assignment using selected context and resources, separately initialized harnesses, permitted harness changes, and expectation checks, iterating until declared completion conditions are met while protecting against repeated external effects and keeping publication separate from completion.

When a Loop requires a specialized capability (such as entity resolution blocking, PDF layout compilation, 3D skeletal inverse kinematics, or statutory decision screening), it invokes an Engine Slot. Each slot defines a 7-Layer ComponentEnvelope:

  1. Layer 1 (Typed Versioned Edge): Strict JSON Schema or Python dataclass definitions for request fields, result fields, and explicit machine-readable refusal codes.
  2. Layer 2 (Pre-Condition and Post-Condition Invariants): Deterministic assertions checked before the engine runs and before its output is accepted.
  3. Layer 3 (Declared Effect Authority): Explicit permissions for filesystem paths, network egress, shell subprocesses, model calls, and secret access. Discovery is strictly effect-free.
  4. Layer 4 (Resource and Latency Budgets): Memory ceilings, CPU/GPU core allocations, and wall-clock timeouts enforced by the host runner.
  5. Layer 5 (Individual and Group Conformance Kit): A mandatory test suite that every engine registered to the slot must pass individually and in multi-component pipeline groups.
  6. Layer 6 (Pinned Source Provenance and License): Upstream Git repository URL, exact commit SHA-256, SPDX license identifier, and container image digest.
  7. Layer 7 (Runtime Selection Policy and Evidence Ledger): Declared preference order and observed latency/accuracy telemetry allowing real-time engine switching without touching caller code.

How External GitHub Projects Enter the Library

Before building any new functional component, our engineering pipeline searches existing open-source repositories, published papers, and reference designs so we never reinvent the wheel unnecessarily. When we harvest a project from GitHub (through getagentfoundry.si), it enters the system through a three-step protocol:

Empirical Comparison: Direct Repo Imports vs. Swappable Engine Slots

We evaluated 40 multi-component engineering workflows across three integration architectures in compare.baltor.ai/systems and compare.baltor.ai/graphs: (1) regenerating code from scratch per prompt, (2) direct unencapsulated third-party imports, and (3) Loop Engine's 7-layer swappable engine slots:

Architecture Pattern Discovery Context Tokens Engine Swap Caller Diff (LOC) Unavailable Dependency Survival End-to-End Conformance Pass Rate
1. Regenerate From Scratch (Raw LLM) 18,400 tokens N/A (Rewrites whole file) 32.5% (Hallucinates APIs) 45.0% (18/40 workflows)
2. Direct Unwrapped Repo Imports 42,000+ tokens (Full source) 145 - 620 LOC across callers 0.0% (Hard crash on missing dep) 67.5% (27/40 workflows)
3. Swappable Engine Slots + Native Twin ≤ 480 tokens (< 2 KB Card) 0 LOC (Runtime config switch) 100.0% (Verified native fallback) 97.5% (39/40 workflows)

Concrete Slot Definition and Runtime Selection

Below is a concrete excerpt showing how an engine slot in engine_slots.yaml binds an external containerized repository adapter alongside a zero-dependency Baltor-native engine and enforces deterministic conformance switching:

slot_id: entity_blocking_canopy_v1
contract_version: "1.0.0"
input_schema: schemas/entity_blocking_request_v1.json
output_schema: schemas/entity_blocking_result_v1.json
conformance_kit: tools/test_entity_blocking_slot_conformance.py
engines:
  - engine_id: splink_duckdb_container_v4
    kind: external_repo_adapter
    source_repo: "https://github.com/moj-analytical-services/splink"
    pinned_commit: "8f3c91a4e2b7d019c54a82e10f9d4b7c6a12e304"
    spdx_license: "MIT"
    sandbox_profile: "container_read_only_workspace"
    priority: 10
  - engine_id: baltor_native_sql_canopy_v1
    kind: baltor_native
    entrypoint: "loop_engine.engines.entity_blocking:NativeSqlCanopyEngine"
    spdx_license: "LicenseRef-Baltor-Proprietary"
    sandbox_profile: "in_process_deterministic"
    priority: 20
selection_policy:
  mode: "evidence_and_availability"
  require_conformance_receipt: true
  on_unavailable_or_timeout: "explicit_receipt_then_next_qualified_engine"

Individual, Group, and End-to-End Conformance Testing

A typed interface alone does not guarantee that two engines are truly interchangeable. In many plugin architectures, two adapters satisfy the same JSON Schema or Python protocol on paper, yet behave differently on boundary inputs, error recovery, or resource cleanup. When a caller swaps Engine A for Engine B in production, downstream steps break silently because Engine B returns unnormalized coordinate frames, sorts records in a different order, or swallows timeout exceptions.

To prevent behavioral drift between engines, Loop Engine enforces a three-tier conformance testing protocol defined in our Functional Component Standard (compare.baltor.ai/systems):

  1. Tier 1 (Individual Slot Conformance Kit): Every slot in engine_slots.yaml points to an executable conformance kit (for example, tools/test_entity_blocking_slot_conformance.py). Whether an engine is an external GitHub repository running inside a read-only container or a Baltor-native Python/Rust implementation, it is fed the exact same golden input fixtures, malformed boundary payloads, and resource-limit probes. Both engines must produce equivalent typed outputs and identical refusal codes before either can be registered as active.
  2. Tier 2 (Multi-Component Group Testing): Functional components rarely run in isolation. An Observation blocking slot feeds a Control Loop hypothesis-tree slot, which feeds a Bayesian log-odds verifier slot. We test connected component subgraphs across all valid Cartesian combinations of registered engines (for example, splink_duckdb_container_v4 + native_hypothesis_tree versus baltor_native_sql_canopy_v1 + native_hypothesis_tree) to verify that edge invariants hold across engine boundaries.
  3. Tier 3 (End-to-End Solution Graph Replay): Before any catalog promotion, complete solution graphs are replayed in a clean environment with deterministic seed locking and network effect isolation.

Why Discovery Must Stay Under 2,048 Bytes per Component

As our component library scales past one million distinct served component files across creative 3D assets, shaders, physics controllers, and investigative verifiers (assets.baltor.ai), loading full source code during planning is impossible. By enforcing that every component publishes a self-contained baltor_contract_card.json under 2,048 bytes, a planning Loop can inspect 50 candidate contract cards in less than 15,000 tokens, verify type compatibility across edges, and materialize full implementation bytes only for the winning nodes.

Preserving Unchanged Implementations

When a customer revises one step of a creative or analytical project, the solution graph preserves every unchanged component implementation instead of paying tokens and wall-clock time to regenerate working code. Only the affected slot or parameter edge is re-evaluated, and every step emits a signed run receipt recording which engine executed, its resource usage, and its conformance verification status. Explore the interactive graph architecture comparisons at compare.baltor.ai/systems and compare.baltor.ai/graphs.


More Technical Essays on blog.tayloramarel.com

Date Article Markdown
2026-10-18 Better Model or Better Harness? Breaking Down the Six-Part Agent Harness Raw .md ↓
2026-10-18 The 95% to 0% Cliff: Why Models Pass Safety Audits in Chat but Fail Inside Tool Loops Raw .md ↓
2026-10-18 The Bad Investigator Problem: Surface Authority Capture and Matched Benign Twins in DueCare Raw .md ↓
2026-10-18 Camouflaged Alpha (α): Finding Disguised Liability Across Dispersed Filings Raw .md ↓
2026-10-18 Jev Evaluations: Stress-Testing Quantized, Sub-2-Bit, and Local Open-Weight Models Under Deterministic Gates Raw .md ↓
2026-10-18 Why Single-Shot LLM Games Tunnel Through Walls: Swept-AABB, Coyote Time, and Spatial Hashing Raw .md ↓
2026-10-18 From Wildlife Video to 49-Bone WebGL2 Rigs: How Field Notes 01 Works Raw .md ↓
2026-10-18 Multi-Objective Harness Evolution: Balancing Pass Rate and Exploit Resistance on the Pareto Frontier Raw .md ↓
2026-10-18 Stop Copy-Pasting the Internet into Your Coding Agent: Machine-Readable Contract Feeds vs. Human Documentation Raw .md ↓