r/LocalLLaMA • u/lucadilo • Oct 06 '26
Discussion An architecture to cryptographically constrain autonomous AI agents at the execution boundary
Hi everyone,
As we move from simple RAG chat to fully autonomous tool-using and coding agents, we are hitting a massive wall: predictability and safety.
Right now, most setups try to secure AI agents using probabilistic methods like system prompt hardening, alignment tuning or reactive LLM-based guardrails (e.g., LlamaGuard). The problem is that these guardrails can be bypassed via Indirect Prompt Injections (IPI), leading to capability escapes, unauthorized shell command executions or runaway API budget depletion.
To solve this, I’ve been working on a framework that completely shifts the paradigm from trusting the model to governing the execution environment using cryptography.
I call it EBP-CA (Execution-Boundary Proofs with Cryptographic Authorization). It is a model-agnostic layer that sits directly between the untrusted agent and the runtime environment, treating every single model-generated action as untrusted.
The core architecture implements six deterministic security primitives:
- Signed Capability Contracts: Immutable cryptographic tokens defining the exact boundaries of what an agent can execute.
- Independently Recomputed Policy Checks: The runtime re-evaluates policy compliance deterministically, bypassing the model's interpretation entirely.
- Short-Lived Single-Use Execution Grants: Atomic, ephemeral tokens issued for a single specific payload to eliminate permanent session hijacking.
- Replay & TOC-TOU Protection: Cryptographic binding of the execution grant to the exact payload hash, neutralizing Race Conditions (Time-of-Check to Time-of-Use).
- Trusted Cost Accounting: Enforced real-time budget tracking at the runtime layer.
- Human-in-the-Loop (HITL) Gateways: Non bypassable prompts that freeze execution and mandate cryptographic user authorization for out-of-scope tasks.
The working prototype currently passes 74 integration tests, validating full resilience against path traversals, command injections, budget bypasses, and sandbox escapes.
The specifications, architectural diagram, and executive summary are available on GitHub under a private proprietary license (free for technical evaluation and research review): https://github.com/lucadilo/ebpca-ai
I'm posting this here because I’d love to get the community's feedback on this approach. How do you see this scaling with kernel-level sandboxing (like eBPF or gVisor integration)? Let's discuss!
2
u/jwdeaver Oct 06 '26
Here's my feedback:
"No permission is granted to use, execute, copy, modify, merge, publish, distribute, sublicense, sell, create derivative works from, or otherwise exploit this software or its associated documentation, in whole or in part, without the prior express written permission of the copyright holder.
Access to or visibility of the source code does not grant any license or other right to the software. Any permission must be obtained directly from the copyright holder in writing before the proposed use begins."
I was excited to comment and help until I got to the license.
2
u/audioen Oct 06 '26 edited Oct 06 '26
I struggle to understand what any of your cryptography buys you.
This boils down to some kind of is_allowed(cmd) function which evaluates whether model can run a command or not. This is generally speaking hard, as the models treat execution failures as bugs and try to work around them. The other key issue is that agents are the more useful the more capable they are, and the less restrictions they operate under. However, they are all the more dangerous and if you let them run around as sysadmin in your servers, they can do pretty much every sort of damage, while still trying to be helpful -- and they would probably be absolutely devastating if they intended to ever take your shit down for good.
As far as I can tell, the meat of your poc is here: https://github.com/lucadilo/ebpca-ai/blob/master/src/cbc.ts that defines some example commands at draft level for what your agents might be able to do, and this file likely handles the verifying of the command: https://github.com/lucadilo/ebpca-ai/blob/master/src/validate.ts and everything else, like the cryptography and all your signed message structures and so on, is just noise that contributes nothing to the solution. Nobody's going to verify signed execution grants, they're going to hand the command to a function that says yes or no. That function can just directly evaluate the safety of the command, is my point.
That problem is hard enough that I think it would be the best to dispense with all the cryptography and other noise around the problem, and just stick to writing a really good is_allowed(cmd). Alternatively, sandboxing your agent to an ephemeral filesystem and firewalling the crap out of it might also work. There exists other ways to mitigate the problems arising from the free spirit nature of the agents, which is to strictly limit what the worst case scenario is. If the agent wants to ssh to your production and rm -rf everything, can it do it? Can it read your mail, possibly containing instructions from a third party? Use a browser with your identity logged in, paypal or amazon account ready to purchase stuff? These are scary questions and a good prompt attack will probably make your agent do almost anything.
My money is on the latter approach winning -- reduce the worst case scenario and treat it like a coworker -- very nice sort of guy, but no matter how nice he is, he won't have the keys to your house, to your car, or your bank account. The agent acts like it is "yours" only if nobody seriously tries to confuse it.
1
u/Portotify Oct 06 '26
This is much closer to the execution boundary than most agent governance proposals I’ve seen. One question I’d be especially interested in is what invalidates an execution grant after issuance but before use. Binding a short-lived grant to an exact payload handles replay and mutation well, and recomputing policy helps with policy changes. But suppose the underlying authority or one of the conditions that justified the grant changes during that window. Is validity derived only from the signed contract and TTL, or can the runtime determine that the authority for this specific effect is no longer current? To me that distinction matters because cryptography can prove that a grant is authentic and unmodified, but that is not necessarily the same thing as proving the proposed effect is still authorized now.