tonytautai home/local-ai/run-local-ai/running/agents/build

make agent

Build the Loop Before the Magic.

Building local ai agents starts with a hundred lines you write yourself, so that you understand what any framework later hides from you.

Tony Tautai

building local ai agents

Start With the Loop

building local ai agents

Every agent, however it is dressed, is a loop: the model reads the state, picks a tool, the tool runs, the result goes back in. Write that loop yourself once, in a hundred lines, before adopting anything. You will understand what a framework is hiding, and you will know how to debug it at nine in the evening. For the broader picture, go back to local ai agents.

Locally, the loop has to cope with a model that is smaller and slower than what the cloud offers. That is not a flaw to apologise for. It is a design constraint, and it pushes you toward fewer, clearer tools.

Tools Are Contracts

Each tool is a function with a name, a short description, and typed arguments. The model only sees the description, so write it the way you would brief a new paralegal: what it does, what it must not be used for, what a good argument looks like. Vague descriptions produce vague calls. We have watched a tool named search get called for everything from a date lookup to a file deletion.

Keep the tool list short. Six well-described tools beat twenty. A local model with a modest context window spends its attention reading your tool descriptions before it even reads the task.

What We Branch Into

building local ai agents

Read the Concepts, Then the Rules

If words like planner, tool call, scratchpad or reflection are still fuzzy, our guide to local ai agent concepts settles them. And before any agent touches a shared drive, read our guide to local ai agent safety. We put safety after building on purpose: people only take the warnings seriously once they have seen an agent do something odd with a folder.

A Working Pattern We Use

building local ai agents

Deterministic steps first, model steps second. Convert the PDF, split the pages, run the OCR: no model needed, no judgement involved. Then one small model classifies, another extracts, a third redacts. The agent is just the script that calls them in order and stops when a confidence score is low. It is less exciting than an autonomous planner and far easier to explain to an auditor.

ssh [email protected]

Prove it on your documents.

Every engagement starts the same way: we run the system on a sample of your own files, under NDA/DPA, and hand you a written report with the scores, misses included. No commitment.

Test it on my documents Request a diagnostic