Valid JSON isn't enough: pinning side-effect targets to stop LLM agents from acting on untrusted data

demirtasfurkan_ · reddit · 2026-11-24

Schema validation isn't the finish line for LLM outputs. The author breaks down three failure modes where valid JSON still damages production agents: silent hallucinations (plausible but ungrounded fields), cross-field contradictions, and untrusted target/provenance drift where an agent picks up a recipient, ID, or path from retrieved text right before a side effect runs.

In the open-source Python repo neuroformatting, the author combines Pydantic v2 validation with pre-execution target pinning (PinnedTarget / guardsideeffect), so side-effecting actions only run when the target's provenance and allowed IDs match what was pinned. A runnable demo (examples/quickauditdemo.py) shows allowed vs. blocked cases (UNTRUSTEDTARGETSOURCE, UNPINNEDTARGETID), plus failure scenarios in examples/productionfailures.py. The post ends by asking how others enforce provenance/allowlists before tool/API execution.

Original post →

More from coding & agent

coding & agent channel →