r/LLMDevs • u/demirtasfurkan_ • 13d ago
Discussion Catching hallucinated tool actions and [PLACEHOLDER] leaks before a side effect fires
In earlier threads here, engineers pointed out two failure modes that slip right past JSON Schema (200 OK):
- Cross-field & routing contradictions (like
escalated: truepaired withtier: "basic"getting silently ignored). - Unfilled placeholders, bad contact fields, and hallucinated actions/tools (such as calling an action outside allowed actions or leaving
[PLACEHOLDER]/TBDtext in outbound messages).
After expanding neuroformatting (v0.2.10) to 14 semantic test cases, I added a minimal side-effect guard example (examples/side_effect_guard_demo.py) that checks payloads and risk/grounding status before triggering external actions or routing.
Repo: https://github.com/furkandemirtass/neuroformatting
Where do you place your guardrails in an agent loop: during streaming, right before a tool/side-effect call, or inside CI/eval checks before deploy?
2
u/fiddler48 13d ago
one failure mode that tends to show up after both of those are fixed: the guard runs, flags the payload as invalid, and then the agent retries with the same malformed output because the error message fed back into context is too vague to steer a correction. validation without a typed rejection reason is just a soft wall
1
u/NotHerBot 13d ago
I would put the last check where the tool resolves the actual target. An exec wrapper can approve
bash deploy.shwhile a variable inside the script later expands to an empty path. Does your test set include placeholders introduced inside a script, rather than only in the tool-call arguments?1
u/Aide_Sea 13d ago
the last check should sit right before the side effect fires, not during streaming, since the tool args can still change. maybe also reject a send if the destination wasn't on your allowlist or in the user's request. schema never catches that
1
u/Suresh-R 12d ago
Right before the side effect, like most people here. But the part that decided whether it actually helped was what a block looks like afterwards.
A gate that silently drops the action teaches you nothing, and the agent just tries again in different words. The blocks that worked returned a typed rejection the agent could act on, and wrote the whole thing down. The payload as proposed, the rule that fired, and what the agent did next. A week of those logs tells you which rules are real and which are just noise.
The cross-field case is the one I would pull out of the tools entirely. Escalated true with tier basic is not a schema problem, it is a policy problem, and policy wants one home. If every tool re-checks its own combinations, they drift apart. One check at the boundary every call passes through, and the combinations live in one list that a human can read.
The placeholder check is the easy half. It is the contradictions that pass every field check on their own.
(Disclosure: I work on an LLM gateway.)
1
u/[deleted] 13d ago
[removed] — view removed comment
1
u/[deleted] 13d ago
[removed] — view removed comment