Puan
28,728
Çözümler
0
- Konum
- Freanchey
- Mesajlar
- 1,522
- Katılım
- 2 Eki 2026
- Tepkime puanı
- 215,504
- Puan
- 28,728
- Web sitesi
- glomaxgpt.com
The trick to putting LLM agents in high-stakes systems isn’t a smarter model — it’s containing the model to one node so the rest of the system is ordinary, testable code. Here are the structural moves, with the contracts and types to implement them.Demos love autonomous agents that loop, call tools, and “figure it out.” Production hates them. The moment an agent’s behavior depends on which path the model wandered down today, you can’t test it, can’t audit it, and can’t let it touch anything that matters. In a regulated or high-consequence system — money movement, healthcare, infrastructure — “it usually works” is a non-starter.This is Level 1 of a six-level maturity model for running LLM systems in production: the determinism layer. Before you can do evals, confidence routing, or anything else higher up the stack, you need the part underneath to hold still. The whole game at this level is one idea — contain the model to a single node so everything around it is ordinary, testable code — expressed through a handful of design moves. You keep the model’s intelligence and remove almost all of the unpredictability. This post gives the contracts, not just the concepts.Agents propose; they don’t actThe most important rule: an agent is a pure function from context to a proposed decision — pure with respect to business state, and deterministic given its gateway (the one nondeterministic call, the model, is injected so tests can fake it). It has no authority to change the world. A separate, dumb, heavily-tested component — the substrate — applies proposals, and only after the required approval.from typing import Protocol, Literal
from dataclasses import dataclass
@dataclass(frozen=True)
class Proposal:
# the structured, proposed change — NOT yet applied
routing: Literal["auto", "hitl_recommended", "hitl_required", "reject"]
def propose(self, ctx: "Context") -> Proposal: ...
# pure: no side effects on business state
def apply(self, proposal: Proposal, approval: "Approval") -> "Effect": ... # the ONLY mutatorBecause propose() is pure, its headline property is one assertion:def test_propose_is_pure():
agent = ClassifyAgent(gateway=FakeGateway(scripted))
assert agent.propose(ctx) == agent.propose(ctx)
# same context → same proposal; no world touchedThe boundary buys you three properties:Testable. propose() is a pure function — same context, same proposal. No mocking the world to test the logic.Safe. A jailbroken or buggy agent produces a bad proposal, not a bad action. The blast radius stops at “a guardrail or a human said no.”Composable. Agents never call other agents. Work flows through the substrate (e.g. a cases table + a scheduler), so there are no hidden chains of side effects to reason about.This single constraint turns “an AI did something we can’t explain” into “an AI suggested something, and here’s exactly what approved it.”One fixed graph per capabilityFree-form ReAct loops are great for exploration and terrible for guarantees. Model each capability as a fixed sequence of nodes where the model is used only where judgment is needed and everything else is ordinary code. The arrow sketch below is abridged for readability; the full node list (with pre_check and memory_write`) is in the next section.entry → load context → reason (LLM) → output guardrail → verify →
judge (sampled) → compose confidence → route → prepare proposal → record → exit
Fixed-graph (this)
-------------- ----------------------- ---------------------------------
Control flow
from dataclasses import dataclass
@dataclass(frozen=True)
class Proposal:
# the structured, proposed change — NOT yet applied
routing: Literal["auto", "hitl_recommended", "hitl_required", "reject"]
def propose(self, ctx: "Context") -> Proposal: ...
# pure: no side effects on business state
def apply(self, proposal: Proposal, approval: "Approval") -> "Effect": ... # the ONLY mutatorBecause propose() is pure, its headline property is one assertion:def test_propose_is_pure():
agent = ClassifyAgent(gateway=FakeGateway(scripted))
assert agent.propose(ctx) == agent.propose(ctx)
# same context → same proposal; no world touchedThe boundary buys you three properties:Testable. propose() is a pure function — same context, same proposal. No mocking the world to test the logic.Safe. A jailbroken or buggy agent produces a bad proposal, not a bad action. The blast radius stops at “a guardrail or a human said no.”Composable. Agents never call other agents. Work flows through the substrate (e.g. a cases table + a scheduler), so there are no hidden chains of side effects to reason about.This single constraint turns “an AI did something we can’t explain” into “an AI suggested something, and here’s exactly what approved it.”One fixed graph per capabilityFree-form ReAct loops are great for exploration and terrible for guarantees. Model each capability as a fixed sequence of nodes where the model is used only where judgment is needed and everything else is ordinary code. The arrow sketch below is abridged for readability; the full node list (with pre_check and memory_write`) is in the next section.entry → load context → reason (LLM) → output guardrail → verify →
judge (sampled) → compose confidence → route → prepare proposal → record → exit
Fixed-graph (this)
-------------- ----------------------- ---------------------------------
Control flow