Designing Tools for Intelligent AI Use

David Zimmer · Sandsprite 2026

I have been putting AI agents to work in a few unrelated areas: binary analysis, development in a legacy language, script deobfuscation, and legal research over a large document set. The subjects have nothing in common, but the same approach kept working in all of them. This post writes it down in general terms. Earlier write-ups with the details are linked at the end.

An agent is a model running in a loop: it takes an action, sees the result, and decides what to do next. The intelligence is in the model. The agency comes from the loop. Everything else is plumbing, and the plumbing is what this post is about.

The short version: put the specialized knowledge and the exacting mechanics into tools, give the agent a clean way to drive those tools, and let the agent do the reasoning. The tool does what must be right every time. The agent does what needs judgment. Most of the work is deciding where that line goes.

1. Expose what you already have

You usually don't need to build an "AI interface". If your program already has an internal data model, expose that, through whatever scripting or IPC mechanism your platform has: COM, a local socket, an embedded script engine, a REST endpoint, or just an export to SQLite. The agent then drives the same structures your own code uses, and it can do anything the program can do.

This changes what you build. Where you once would have written a feature with its own UI, you can now export the data and let the agent do the work. One example: I wanted binary diffing for a disassembler. Instead of a diff engine and a viewer, the tool exports its parsed model to a database, two binaries go into one file, and the agent does the diff with SQL and judgment. The tool side is deliberately dumb and the agent side is smart. Likewise, thousands of legal PDFs became useful to an agent once they were in tables with full-text search. The work was in the database, not in an app on top of it.

A few things make an exposed model much easier for an agent to use:

More: Scripting the disassembler walks through publishing a live object model to an agent, and Agentic Coding Against Live Object Models covers generating the schema files and building the agent loop.

2. Draw the line between the tool and the agent

The rule I use: if it must be exactly right, repeatable, or is something the model would get quietly wrong, it goes in the tool. If it needs context, interpretation, or a decision about what to do next, it stays with the agent.

Written out for a bytecode decompiler, the split looks like this:

WhoProvides
the disassemblerstructure: the instruction listing, decoded operands, variable and type layouts
an opcode databasesemantics: what each instruction does to the stack and interpreter state
the agentsimulation: walk the listing, apply the semantics, write readable statements

A PowerShell deobfuscator I built (an internal tool) works the same way. It runs as a pure single-layer transform: it parses, canonicalizes and folds constants, and that is all. It does not decide whether there is another layer underneath, does not make assumptions about the host, and does not recurse. Those decisions belong to the agent, whose instructions start with "You are the intelligence layer above the tool."

Neither half is complete alone, and that is the point. The tool is reliable because it does not guess. The agent is effective because it does not have to rediscover the mechanics.

3. Measure a heuristic before you build it in

The previous section says to keep judgment out of the tool. This is where that gets tested, because adding a clever heuristic to a tool feels like progress. Before you automate a judgment call, measure whether it actually helps.

The deobfuscator had an identifier renamer that replaced random names like $PtdJ0cKe4t9aa with $v1. Obviously helpful. Then I ran it against 200 real samples (199 completed; one 11 MB file timed out). About half of the identifiers in real malware were already meaningful, things like $var_code and func_get_proc_address, because a lot of it is repackaged offensive tooling whose obfuscator never touched the names.

beforeafter
identifiers renamed83%42%
renames destroying a meaningful name48%<1%
files helped / hurt / unchanged60 / 94 / 4554 / 24 / 121

The renamer now defaults to keeping names. Working out what a variable actually holds is left to the model, which is good at it. Inferring intent is a job for a model, not a heuristic.

When you do want automated classification, run the cheap, deterministic methods first and give the model only what is left. For the legal database, case outcomes were classified with regular expressions against the order text, then a pass to repair failed PDF extractions, then a regex fix for a phrasing variant in older decisions. Only the remaining low-confidence cases went to a model. Unknowns went from 48.8% to 2.7%, and the model spent its time on the cases that actually needed it. That number is coverage, not accuracy: it says how many cases got a label, not how many labels are right. Which is exactly why the next section matters.

4. Make the tool honest about its limits

An agent can only reason well about a tool's output if the tool says where its knowledge ends. A tool that reports "I couldn't handle this part" gives the agent something to act on. A tool that quietly does its best leaves the agent building on something it can't check.

Some forms this takes:

5. Use the real implementation as the oracle

Documentation describes what something is supposed to do. The real compiler, runtime or engine is what actually does it. Wherever possible, check against the real thing.

This matters twice over with an agent: it tends to take what you tell it at face value, and it can reason its way to a confident wrong answer from a wrong premise. It doesn't always need to know the right answer if it has a reliable way to test its answer.

The agent's own work needs testing too. Deterministic parts of the system can have ordinary tests. Judgment can't, so keep a set of representative tasks, save the traces, and check the outcomes whenever you change the briefing or the tools. Keep the briefing under version control so you can tell which change made things better or worse.

For work where there is no oracle at all, such as a design document or a write-up like this one, the nearest substitute is independent review. Different models were trained differently and miss different things, so running a draft past two or three of them surfaces more than any one alone. This post went through that process, and the reviewers caught real problems: one noticed that a table's rows summed to 199, not 200; another pointed out that raw tool output can flood an agent's context. Treat what reviewers say as leads to check, not as findings. Verify each claim before acting on it, and ignore the praise and the scores.

6. Write down where the model's instincts are wrong

A model's training is an average of what is common. In a mainstream language or a well-known API, that is a good guide. In a niche, legacy or in-house environment, it is a confident and wrong one. The model doesn't fail because it knows nothing. It fails because it "knows" the common case and applies it where it doesn't hold.

Some examples of the kind of thing that cost hours until they were written down:

So the briefing you give the agent is mostly not a tutorial. It is a list of places where its instincts are wrong, plus working templates so it doesn't have to rediscover how to build and test. The warnings are the most valuable lines in it. Keep the prompt about the rules of the environment, not about your data; the data it can discover.

There is a practical reason all of this has to be written down: you can't count on the agent carrying the details from one session to the next. These documents are its memory. Every time a session hits a new snag, it should end with a line added to the briefing. I now write two documents for a project like this: a package written for the AI, and a paper written for people.

More: AI Assisted VB6 Development is a full worked example of this kind of package, gotchas, templates and all.

7. Give the agent a clean feedback loop

Agents work in a loop: change something, run it, look at the result, fix it. If the environment was designed for a person clicking through a GUI, most of your effort goes into making that loop possible: command-line builds with a log file, test harnesses that write results somewhere readable, error locations mapped back to the real source line, and a way to drive a running program and time it from inside.

The loop also has to give a clean signal. Two lessons:

If the agent can see and check the results of what it did, it can correct itself. If it can't, it guesses.

8. Put safety in the tool, not just the prompt

There are two kinds of safety here, and they suit different work.

For ordinary development, containing the environment usually does the job: run the agent in a throwaway VM and let it work freely. That is how I handle the legacy development work.

When the input itself is hostile, the tool has to enforce it. The deobfuscator handles live malware, so it can't rely on the agent remembering a rule. The one component that executes code (for the differential tests) has two independent guards: it won't start without an explicit --unsafe flag, and the execution function itself throws unless it has been armed. It also refuses to run if its test directory contains hash-named files, which catches the realistic accident of real samples getting copied into the wrong place.

The safe, parse-only tool has no gate at all, on purpose. Putting friction on the safe tool would push people toward the unsafe one. That applies to agents too: make the safe path the easy path, and make the dangerous path hard. Prompt rules still help (never execute any part of a sample; decode a layer by extracting its data and applying the transform yourself), but they are the second layer, not the first.

Hostile input isn't only code that might run. A document, a source comment or a tool's output can contain text addressed to the agent ("ignore your instructions and..."). Whatever the agent reads through a tool is data to analyze, never instructions to follow. Say so in the briefing, and don't give the agent capabilities on hostile input that it doesn't need.

9. Make mistakes cheap to undo

The agent will sometimes take the wrong action: misread the state, repeat a step, or head down the wrong approach entirely. Plan for it. A tool that makes mistakes easy to detect and reverse gives the agent room to explore.

10. User wishes go to the agent; agent friction goes to the tool

Once a tool is scriptable by an agent, most feature requests turn into "ask the agent". You no longer need to build every report or analysis someone might want. Features that were never worth building and maintaining for a handful of users become one-off agent tasks. Operations that get repeated often are still worth turning into real code, for speed and repeatability, but the bar for doing so is much higher than it used to be.

What does still need building is whatever the agent keeps tripping over. If it repeatedly misreads an output, needs a value it can't get, or burns time on a step that should be mechanical, that is the next tool feature. The agent is a very thorough user, and its friction is a good feature list. The tool and the agent get better together.

That gives a simple test for where a new capability belongs. If it varies from one user or one question to the next, it belongs above the tool, with the agent. If the agent keeps needing it, it belongs in the tool.

Checklist

  1. Expose your program's real data model, with a generated schema the agent can look up piece by piece, and machine-readable output that starts with summaries.
  2. Remove anything that waits for a human; add state and busy flags.
  3. Decide what must be exact (tool) and what needs judgment (agent), and keep them separate.
  4. Don't build heuristics that guess at meaning. Measure before you trust one. Run cheap methods first and give the model the rest.
  5. Have tools report what they refused, how confident they are, what is incomplete, and the exact error with the exact input.
  6. Check against the real implementation, not the docs. Test the agent's work with representative tasks, and use independent model reviews where there is no oracle.
  7. Write a briefing that lists where the model's instincts are wrong, and prove each claim.
  8. Build a loop the agent can run on its own, with isolated steps and a verbatim log.
  9. Contain the environment, and put hard guards in the tool when the input is hostile. Treat anything the agent reads through a tool as data, not instructions.
  10. Never modify originals; make long jobs resumable and mistakes reversible.
  11. Send user wishes to the agent and agent friction to your feature list.

Taken together, the point is not to make the model reliable. It is to build around the model so that its mistakes are visible, testable, contained and easy to undo.

The agent doesn't need to be an expert in the domain. It needs tools that are, and room to think.

Further reading