All posts
July 17, 2026·4 min read

An AI Agent for Writing Code: Coding Alongside an Agent Locally

How an AI coding agent differs from autocomplete, what the 'describe the task — the agent writes, runs, and fixes' loop looks like, which model to pick, and where the trust boundary sits. A practical breakdown using Doka.

Coding assistants come in two very different types, and people constantly mix them up. Some complete a line as you type — that's autocomplete. Others take on a whole task: read the project, write code across several files, run it, and fix it based on the result. Those are agents. The difference is fundamental, and if you're looking for the second kind, here's how it works and what to expect.

Autocomplete and an agent aren't the same thing

Autocomplete lives inside an editor and suggests the next line. It speeds up typing, but it doesn't do the task — you're still the one thinking and steering. That's how Copilot and similar editor tools work.

An agent works differently. You describe what you need in words, and it decides which files to open, what to change in them, which command to run. You're not typing code alongside it — you set the task and check the result.

What the work loop looks like

The best way to understand an agent is through a typical loop. You say: "find out why this test is failing and fix it." From there, Doka works through the steps:

First, the agent reads the relevant files to understand the context. Then it makes an edit. Then it runs the test in the terminal and looks at the output. If the test is still failing, the agent sees the error, edits again, and repeats — until it works or it hits something that needs your call.

The key part here is feedback. The agent doesn't hand you code blind — it checks itself against the result of running it. That's what separates "did it" from "suggested it": you get something that actually passed a check, not a hypothesis.

An agent works best on tasks with a clear check — a test, a build, a run that shows whether it worked or not. The clearer the "done" criterion, the more independently it works.

Which model to pick for code

Code quality depends on the model, and there's a real choice here. Doka isn't locked to one provider: you can work on the built-in local model, connect a code-focused model as your own .gguf file or through Ollama/LM Studio, or connect a cloud model over an API for a heavy task.

The practical rule is simple. Keep private or work code you don't want leaving your machine on a local model. For a one-off complex task with no confidentiality concerns where you want maximum strength, a cloud model is fine. Switching takes seconds, so you can pick per task instead of committing once and for all.

Why local is convenient for code specifically

Code is exactly the case where privacy isn't abstract. Work repositories, private projects, snippets with keys and internal logic — none of that is something you want sent to someone else's cloud. A local agent keeps both the code and the model on your own machine, so the question "where did my project go" simply doesn't come up.

As a bonus: no limits and no subscription — a local model runs for free, as much as you want. For experimenting and rapid iteration, where you run the agent through dozens of rounds, that adds up noticeably.

Where the trust boundary sits

The honest part, without which the picture would be incomplete. An agent makes mistakes. It can write code that compiles and passes the linter but does the wrong thing, because it misread the task. Hence the rule: read what it did. Doka shows the agent's steps and changes, and that's not a formality — it's your checkpoint.

It matters especially not to switch off attention during long sessions. The temptation to accept everything once it "seems to work" is strong, but that's exactly how quiet bugs sneak into a project. The right mode is: the agent does the heavy mechanical part, and you keep the meaningful decisions and the final check for yourself.

Where to start

Don't hand the agent a whole new feature from scratch right away. Start with tasks that have a clear check: fix a failing test, add a small function with a test, run a mechanical refactor. On tasks like these, you quickly get a feel for where the agent genuinely saves time and where it needs your oversight. Expand from there as trust builds.

Download Doka for free, and for how the agent works overall, see the article on the local AI agent.

What if the code is a game

Gamedev brings a few specific scenarios to this class of tool. Diagnosing an Accessed None error in a Blueprint from logs, working with an Unreal project through UE 5.8's built-in MCP server, building a Java mod for Minecraft with Gradle errors to work through. What they have in common: an agent is useful wherever there are logs to read and files to edit in bulk, not where you need to invent gameplay.