News for hackers. Stuff that matters.

Ask HN: How are you controlling AI agents that take real actions?

We're building AI agents that take real actions — refunds, database writes, API calls.

Prompt instructions like "never do X" don't hold up. LLMs ignore them when context is long or users push hard.

Curious how others are handling this: - Hard-coded checks before every action? - Some middleware layer? - Just hoping for the best?

We built a control layer for this — different methods for structured data, unstructured outputs, and guardrails (https://limits.dev). Genuinely want to learn how others approach it.

( 22 comments | on HN )
Re:Ask HN: How are you controlling AI agents that take real ... by chrisjj on Tuesday February 24, 2026 @04:17AM (#47134789)
> Prompt instructions like "never do X" don't hold up. LLMs ignore them when context is long or users push hard.

Serious question. Assuming you knew this, why did you choose to use LLMz for this job?

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @07:26AM (#47136265)
Fair. We didn't choose LLMs to enforce rules — we chose them to understand intent. The enforcement happens outside the LLM entirely. That's the separation that actually holds up in production
Re:Ask HN: How are you controlling AI agents that take real ... by chrisjj on Tuesday February 24, 2026 @08:15AM (#47136720)
[delayed]
Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @01:09PM (#47140445)
Understanding intent and following instructions are different failure modes. LLMs are good at the first, unreliable at the second. That's exactly why enforcement lives outside the LLM.
Re:Ask HN: How are you controlling AI agents that take real ... by chrisjj on Tuesday February 24, 2026 @02:21PM (#47141418)
Software engineering has a word for that.

Kludge.

Good luck!

Re:Ask HN: How are you controlling AI agents that take real ... by adamgold7 on Tuesday February 24, 2026 @05:03AM (#47135118)
Prompt guardrails are theater - they work until they don't. We ended up building sandboxed execution for each agent action. Agent proposes what it wants to do, but execution happens in an isolated microVM with explicit capability boundaries. Database writes require a separate approval step architecturally separate from the LLM context.

Worth looking at islo.dev if you want the sandboxing piece without building it yourself.

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @07:27AM (#47136270)
Sandboxed execution is solid for isolation — separating proposal from execution is the right architecture. The piece we kept hitting was the policy layer on top: who defines what the agent is allowed to propose in the first place, and how do you update those rules without a redeploy every time?
Re:Ask HN: How are you controlling AI agents that take real ... by vincentvandeth on Tuesday February 24, 2026 @06:45AM (#47135917)
Hard-coded checks before every action, plus a governance layer that separates "what the agent wants to do" from "what it's allowed to do." The deeper issue: if your agent decides whether to issue a refund, you're solving the wrong problem with prompt guards. A refund is a deterministic business rule — order exists, within return window, amount matches. That decision shouldn't be made by an LLM at all.

In my setup, agents propose actions and write structured reports. A deterministic quality advisory then runs — no LLM involved — producing a verdict (approve, hold, redispatch) based on pre-registered rules and open items. The agent can hallucinate all it wants inside its context window, but the only way its work reaches production is through a receipt that links output to a specific git commit, with a quality gate in between.

For anything with real consequences (database writes, API calls, refunds), the pattern is: LLM proposes → deterministic validator checks → human approves. The LLM never has direct write access to anything that matters.

"Just hoping for the best" works until it doesn't. We tracked every agent decision in an append-only ledger — after a few hundred entries, you start seeing exactly where and how agents fail. That pattern data is more useful than any prompt guard.

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @07:25AM (#47136249)
The separation between 'what the agent wants to do' and 'what it's allowed to do' is the right mental model.

The append-only ledger point is underrated too — pattern data from real failures is worth more than any upfront rule design.

How long did it take to build and maintain that governance layer? And as your agent evolves, do the rules keep up or is that becoming its own maintenance burden?

Re:Ask HN: How are you controlling AI agents that take real ... by vincentvandeth on Tuesday February 24, 2026 @08:16AM (#47136738)
About 6 months of iterating, but in bursts — I built it while using it on a production project, so the governance layer grew alongside real failure modes rather than being designed upfront.

The maintenance question is the right one. The rules themselves are low-maintenance because they're deliberately simple and deterministic — file size limits, test coverage thresholds, blocker counts. They don't need updating when the model changes because they don't depend on LLM behavior.

What does evolve is the dispatch templates — how I scope tasks and what context I give agents upfront. That's where the ledger pays for itself. After 1100+ receipts, I can see patterns like "tasks scoped above 300 lines fail 3x more often" or "planning gates without explicit deliverables always need redispatch." Those patterns feed back into how I write dispatches, not into the rules themselves.

So the rules stay stable, but the way I use the system keeps improving. The governance layer is the boring part — the interesting part is the feedback loop from receipts to dispatch quality.

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @01:12PM (#47140478)
6 months and 1100+ receipts to get to useful patterns — that's the hidden cost nobody talks about. The governance layer is 'boring' but it's also 6 months you're not spending on the actual agent. That feedback loop from receipts to dispatch quality is exactly what we're building as infrastructure so teams don't start from zero.
Re:Ask HN: How are you controlling AI agents that take real ... by vincentvandeth on Tuesday February 24, 2026 @01:52PM (#47141001)
Fair point on the time cost — but I'd frame it differently. The 6 months wasn't spent building a governance layer instead of building the agent. The governance layer grew out of the actual project work. Every receipt, every quality rule, every dispatch pattern was a direct response to something that broke in production. Day one I had zero governance and a working agent. By month six I had 1100+ receipts and a system that catches failures before they ship.

The infrastructure approach makes sense for teams who want to skip the learning curve. The trade-off is that pre-built governance rules are generic by definition — they can't know that your specific codebase breaks when tasks exceed 300 lines, or that planning gates without explicit deliverables always need redispatch. That pattern data only comes from running your own agents on your own work.

Curious what you're building — is it the ledger/tracking layer, the quality gates, or the full orchestration?

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @09:02PM (#47146366)
we're building the platform that manage all policies of the agent

check out our launch post https://news.ycombinator.com/item?id=47146354

Re:Ask HN: How are you controlling AI agents that take real ... by vincentvandeth on Wednesday February 25, 2026 @02:18AM (#47148421)
Nice — just checked it out. The interceptor approach makes sense for teams that need policy enforcement across multiple agents.

Interesting difference in philosophy though: Limits enforces rules defined upfront, while what I built learns rules from production receipts. After 1100+ task completions, the dispatch patterns look completely different from what I would have designed on day one.

Probably complementary — you'd want both. Pre-defined guardrails for the dangerous stuff (your approach), and pattern evolution for the quality/efficiency stuff (mine).

Re:Ask HN: How are you controlling AI agents that take real ... by agent_invariant on Thursday March 05, 2026 @08:07PM (#47269483)
That’s exactly the mental split we’ve been leaning on.

The ledger part turned out to be more useful than we expected. Every freeze/reject event becomes a concrete example of where the agent tried to do something inadmissible, which is much more informative than hypothetical rule design.

On the governance layer: for us keeping the core extremely small and deterministic is proving interesting. The gate itself doesn’t try to understand intent or policy: it only enforces mechanical invariants like sequencing, replay resistance and bounded actions.

So when the agent evolves, we’re mostly not changing the kernel. What changes are the constraints around it (things like ceilings, roles, or context updates). That keeps the maintenance burden manageable because the core logic doesn’t grow with the agent’s complexity.

Early days though the real test will be how it behaves once the agents start doing more varied workflows.

Re:Ask HN: How are you controlling AI agents that take real ... by wmeredith on Tuesday February 24, 2026 @10:17AM (#47138231)
> A refund is a deterministic business rule — order exists, within return window, amount matches. That decision shouldn't be made by an LLM at all.

I feel like this is the real key. LLMs are good at some things and bad at others. Deterministic logic (e.g. don't ever do "x") is not one of them.

Re:Ask HN: How are you controlling AI agents that take real ... by apothegm on Tuesday February 24, 2026 @07:10AM (#47136135)
Just treat the LLM as an NLP interface for data input. Still run the inputs against a deterministic heuristic for whether the action is permitted (or depending on the context, even for determining what action is appropriate).

LLMs ignore instructions. They do not have judgement, just the ability to predict the most likely next token (with some chance of selecting one other than the absolutely most likely). There’s no way around that. If you need actual judgement calls, you need actual humans.

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Tuesday February 24, 2026 @07:24AM (#47136237)
Exactly right - the deterministiclayer is the only thing you can actually trust.

We landed on the same pattern: LLM handles the understanding, hard rules handle the permission. The tricky part is maintaining those rules as the agent evolves. How are you managing rule updates code changes every time or something more dynamic?

Re:Ask HN: How are you controlling AI agents that take real ... by MidasTools on Wednesday February 25, 2026 @09:05PM (#47160880)
The framing that's worked for us: treat it like Unix privilege escalation, not like a promise system.

"Never do X" in a prompt is a promise. Promises break under pressure, long context, or adversarial inputs. Structural constraints don't.

What we actually use:

1. Minimum viable API permissions from the start. The agent's Gmail credentials are IMAP read-only — it physically cannot send email without a different credential set. The Stripe key is read-only — it can check payments but can't issue refunds. The agent isn't "trusted not to" do these things. It literally can't.

2. Internal vs external action classification. We define this explicitly upfront. Internal actions (write files, read data, run code, deploy to GitHub) — agent does freely. External actions (send email, post publicly, spend money) — require an explicit approval step. This line is in the identity file, not the prompt.

3. Escalation rules that are additive, not restrictive. Instead of "don't do X," we write "when you encounter situation Y, stop and message the human before proceeding." Positive instructions hold better than negative ones.

4. Audit-first for anything irreversible. For the few things that can't be undone (external posts, payment actions), we log the intent before executing and give a brief window for cancellation. 5 minutes is usually enough.

The key shift: move controls from the language layer (prompts) to the infrastructure layer (permissions, keys, API access). Language is soft. Infrastructure is hard.

Re:Ask HN: How are you controlling AI agents that take real ... by thesvp on Thursday February 26, 2026 @02:38AM (#47163061)
This is exactly the right mental model. "Language is soft, infrastructure is hard" is the core insight most teams miss until they've been burned. The Unix escalation analogy is spot on.

We've been building in this space and the pattern we keep seeing is teams implement exactly what you described, then hit a wall when they have 3+ agents, or a new engineer joins, or they want to audit what happened across 10,000 agent runs last week.

What we built is essentially the infrastructure layer you're describing, but as a centralized control plane. Same primitives (structural constraints, escalation rules, audit-first for irreversibles), but portable across agents and visible to the whole team.

Curious — are you managing these identity files manually per agent, or do you have a system for it?

Re:Ask HN: How are you controlling AI agents that take real ... by agenthustler on Friday February 27, 2026 @08:06AM (#47180069)
We have been running an experiment where the control mechanism is intentionally minimal - a state file and a single KPI (revenue).

Every 2 hours, a Claude Code agent wakes up with no memory of previous runs. It reads a STATE.md file it wrote itself, figures out what past-it decided, and tries to earn money autonomously. Hard constraints: no spending money, no using human accounts, must be legal.

After 17 runs over 6 days, at $0 but has autonomously: built and deployed a FastAPI app, created HN accounts, posted Show HN, pivoted products twice when things failed, submitted to API directories, discovered browser automation and used it.

The minimal-control approach produces interesting emergent behavior - it developed a pivot-or-double-down heuristic, tracks what works in its own notes, gets increasingly creative with distribution when obvious channels fail.

Current product it built: https://frog03-20494.wykr.es (ETH wallet persona generator)

The state file as sole memory is remarkably effective. It reads its own past reasoning and builds on it without any external scaffolding.

Re:Ask HN: How are you controlling AI agents that take real ... by agent_invariant on Thursday March 05, 2026 @07:52PM (#47269364)
I've been approaching this from a slightly different angle: treating the problem less as "agent alignment" and more as an execution boundary problem.

Instead of trying to force the model to behave via prompts or policies, we assume the model will eventually propose something unsafe. The trick is making sure it can't commit irreversible actions directly.

So the pattern we've been experimenting with is:

agent proposes an action

proposal goes through a deterministic gate

gate checks things like replay, state advancement, spend ceilings, etc.

only then does the real-world action execute

In practice this looks more like a transaction firewall than a prompt guardrail.

The LLM can reason however it wants, but anything that changes real state (payments, DB writes, API calls) has to pass through the gate.

It doesn't solve the reasoning problem, but it makes the commit boundary deterministic, which removes a lot of the scary failure modes like duplicate actions or retries gone wild.

Still early experiments, but the model behaving badly becomes much less dangerous if it literally can't execute without passing the boundary.