Why AI Agents Should Propose Change Sets, Not Final State
An AI agent should not return the new state of a system. It should return a change set against a state it has actually seen.
That sounds like a small serialization choice. It is an architectural boundary.
When a model emits a complete configuration, document, policy, or record, unchanged fields become implicit claims. Did the agent preserve them deliberately? Did it forget them? Were they absent from context? A full replacement hides the answer. A change set makes intent finite: these are the paths I want to add, remove, replace, move, copy, or test.
This article is not a claim that JSON Patch makes an agent safe. It does not. It is a proposal for a better intermediate artifact between probabilistic reasoning and state mutation.
Full state is an ambiguous instruction
Imagine an agent editing a deployment object. It reads version 41, changes a resource limit, and returns an entire object that looks authoritative. Before commit, another process adds a label and rotates a secret reference. If the executor treats the model output as replacement state, the agent can erase both changes without ever reasoning about them.
The model did not choose to remove those fields. The representation made omission indistinguishable from deletion.
A change set says less, and that is its strength:
[
{"op":"test","path":"/version","value":41},
{"op":"replace","path":"/resources/memory","value":"768Mi"}
]
The first operation is a precondition. The second is the intended mutation. If the observed version is stale, application stops. The runtime can request a fresh proposal instead of pretending that a stale answer is current.
Patch is not one idea
Two IETF standards expose an important engineering choice.
JSON Patch (RFC 6902) defines an ordered operation list: add, remove, replace, move, copy, and test. Ordering matters. Paths are explicit. test can make assumptions executable.
JSON Merge Patch (RFC 7396) describes the desired shape by example. It is compact for object updates, but null means removal and arrays are replaced as units. It is therefore a poor fit when null is meaningful or when list edits need precise identity.
For an agent boundary, I usually prefer the operation list. Not because it is universally better, but because review needs verbs. “Replace this path” is easier to authorize than “accept this regenerated object.” Merge Patch remains useful for simple, schema-constrained partial updates.
| Question | Full replacement | Merge Patch | JSON Patch |
|---|---|---|---|
| Is deletion explicit? | often ambiguous | represented by null |
explicit remove |
| Can assumptions be checked? | external mechanism | external mechanism | test operation |
| Are list edits precise? | whole list | whole list | path-level, with caveats |
| Is intent easy to review? | low | medium | high |
The change-set envelope
Raw patch operations are still not enough. I would place them inside a signed or hash-addressed envelope:
{
"target": "deployments/payments-api",
"base_revision": "sha256:…",
"schema": "deployment-policy/v3",
"operations": [
{"op":"test","path":"/replicas","value":3},
{"op":"replace","path":"/replicas","value":4}
],
"reason": "requested capacity change",
"expires_at": "2026-07-12T14:45:00Z"
}
Each field closes a different ambiguity:
targetprevents the patch from floating to a different object;base_revisionbinds it to observed bytes or canonical state;schemachooses the validator and path semantics;operationscarries the minimal intent;reasongives reviewers context but never authority;expires_atprevents an old approval from becoming a standing capability.
The artifact should be produced before permission is evaluated. The model proposes. A deterministic validator checks syntax, schema, forbidden paths, value ranges, and cross-field invariants. Policy then evaluates the exact artifact. Only the executor commits it.
This separates three questions that agent loops often collapse:
- Is the proposal structurally valid?
- Is this exact change authorized?
- Can it still be applied to the state that was observed?
A “yes” to one is not a “yes” to the others.
Review the semantic diff, not model prose
Natural-language explanations are useful, but they are not the unit of approval. The runtime should render a semantic view from the validated operations:
TARGET deployments/payments-api
BASE 41
CHANGE /replicas: 3 -> 4
RISK capacity, cost
DENIED /secrets/*, /network/egress/*
The reviewer approves the artifact hash, not a chat message that can drift away from it. This extends the same discipline I described in executable authorization: authority belongs at the execution boundary. It also complements canonical JSON as an intermediate representation: canonicalization gives an artifact stable identity; a change set gives that identity bounded intent.
After commit, the runtime should emit a receipt containing the proposal hash, prior revision, resulting revision, policy decision, and executor result. That receipt is evidence of what happened. The model's explanation is only evidence of what it intended to suggest.
Where this pattern breaks
JSON Patch paths are positional for arrays. Concurrent list edits can make an index point to a different element. Domain objects may need stable IDs or domain-specific commands instead. Some invariants span services and cannot be validated against one JSON document. Secrets should not be copied into proposal artifacts merely because the format permits it. And a valid patch can still encode a destructive but authorized action.
There is also no automatic merge theorem here. When the base revision changes, the safest default is rejection and regeneration. A domain-aware rebase may be possible, but it must prove that touched paths and relevant invariants are unchanged. Blindly replaying a stale patch just relocates the ambiguity.
So the boundary condition is clear: use generic patches where state is document-shaped and path semantics are stable. Use typed domain commands where meaning is richer than document mutation.
A proposal should be smaller than its consequence
The central design move is not “use RFC 6902 everywhere.” It is this:
Never let a probabilistic component silently manufacture final state when it can propose an explicit mutation against a named revision.
A good agent proposal is minimal, expiring, preconditioned, schema-bound, and reviewable. A good runtime can reject it without guessing. A good receipt can later prove exactly which proposal crossed the boundary.
Models are good at suggesting change. Systems must remain responsible for deciding whether that change is valid, authorized, current, and committed.