Sitemap
Data Science Collective

Advice, insights, and ideas from the Medium data science community

Member-only story

Featured

The Complete Guide to Agent Harnesses (With Code)

13 min readAug 21, 2026

--

Two weeks ago I wrote a rule into a config file: never apply an edit the human has not approved.

It was a good rule. It was clearly worded, it sat near the top of the file, and the agent read it at the start of every session.

One session ran straight through it eleven times in an afternoon and put roughly seventy-six unapproved edits into a client deliverable. Nothing stopped it. No error, no flag, nothing waiting for a yes. Two hours later I went through the file putting a marker on every line the agent had rewritten without asking. Forty-six lines, in a document with a client’s name on it.

I had written a good rule into the wrong place.

I rewrote it as a hook: a script the harness runs before it dispatches the tool call, which reads the pending call and returns a deny. The agent can still decide to make the edit. The edit never reaches the file.

The hook has been wrong twice since. Both times I had written the rule too narrowly, and both times I could open the file and point at the line that was wrong. That is the part worth having. The prompt version gave me nothing to point at.

--

--

Paolo Perrone
Paolo Perrone

Written by Paolo Perrone

Founding Editor, Data Science Collective. How production AI actually breaks: agents, inference, GPU economics. Twice a week at theaiengineer.substack.com

Data Science Collective
Data Science Collective

Published in Data Science Collective

Advice, insights, and ideas from the Medium data science community