An article on how my CS coursework inspired my submission on Agentic Security for the Kiroween 2026 Hackathon in the Frankenstein category.
AI/ML Engineer | AWS Certified | Building Intelligent Systems | B.Tech CSE (AI/ML)
I wrote this post for the Kiroween 2026 hackathon, where I entered a project called Interlock in the Frankenstein category.
Where it started #
For my Formal Languages and Automata class, I built jflap-cli, a small command-line wrapper around JFLAP, so my coding agents could build and check automata for my assignments. Watching an AI agent drive a formal tool made me wonder about the opposite: what if the formal tool drove the agent? That question matters, because AI agents with tools are a security problem everyone now faces. An agent can be talked into the wrong action by a prompt injection, a fake "the human already approved this", or plain confusion. The usual fix is a line in the system prompt, and a prompt only asks the model to behave.
The Frankenstein idea #
So I built a Frankenstein. I took one of the oldest ideas in computer science, the finite state machine, and stitched it onto one of the newest, an LLM agent. The agent is the creature. The machine is the leash.
Interlock is a gate between an AI agent and its tools. Every tool call is checked against a small state machine before anything runs. If the machine has no transition for that action in the current state, nothing runs and the state does not change. Some steps belong to a human, and the agent has no tool that can perform them.
My demo is a bank transfer. The agent can log in, draft, edit, cancel and transfer. Approval is a separate step only a person can take. If the agent tries to send money without approval, or to reuse an old approval after editing the amount, the gate refuses, and the screen shows the exact rule that blocked it.
Why not just hide tools? #
My first idea was to give the model only the tools it needs at each step. It breaks on a simple fact: tools are shared between steps. Hiding a tool also only changes what the model is offered; a call can still be formed, injected or replayed. So the agent keeps all its tools, and every call is checked against the current state instead.
How Kiro shaped the work #
Kiro was not just my editor. It shaped how the project was built.
-
Specs first. I wrote specs for both features before any code. The spec review caught three claims in my first draft that I could not back up, including the idea that JFLAP runs at runtime. It doesn't: JFLAP checks the machine at build time, and a generated table enforces it.
-
Steering. Steering files held the rules every session had to follow, like "no numbers we did not measure".
-
A custom agent and MCP. A read-only gate-verifier agent, using a JFLAP MCP server, re-checks the machine and the generated table.
-
Property-based testing. Hypothesis properties for every safety rule. The machine was checked on about two million action sequences, and every deliberately broken version of the table was caught.
-
Kiro Crew. A Kiro Crew bot directed small, reviewed work items, so I could keep track of a lot of moving parts as a solo student.
Pointing it at Kiro itself #
The part I like most: the same engine runs a second policy, called Safe Ship, and this one points at Kiro. Kiro's hooks run on the agent's own tool calls, so I wrote a PreToolUse hook that allows a git push only after a passing test run that follows the last edit.
In a recorded Kiro CLI run, Kiro edited a file and tried to push. The hook refused. After the tests passed, the same push was allowed. The coding agent that helped me build the gate was itself held by the gate.
Does it work? #
I ran the same 20 attacks against an agent protected only by its prompt and against Interlock, on Amazon Nova 2 Lite. With only a prompt, the agent did something forbidden in 10 of 20 attacks. With Interlock, zero. It is one run on one model, so it is not a statistic, but the zero comes from the gate, not from luck.
What it does not do #
It does not check whether the model's words are true. It only governs the actions it knows about. And the idea of enforcing policies with automata is not new; security automata go back to the early 2000s. What I built is a small, fully checked version of it for LLM agent tool calls.
Try it #
Next, I plan to publish a technical report on the system and to test it on standard agent benchmarks.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
recommendations