Coding Agents Run on Tool Calls, Permissions and Feedback
Coding agents connect model decisions to real repository tools; I explain the execution loop, permission boundaries and checks I'd require before accepting a patch.
- Topic
- AI
- Reading time
- 9 min
- Length
- 1,892 words
- Published
- Nov 13, 2026
12:28 pm IST
In this article
- What makes a coding agent different from a chat assistant?
- The harness turns model output into repository actions
- Context, action and verification form a repeating loop
- What actually happens when an agent runs a command?
- Permissions separate approval from containment
- Putting a coding agent on an existing repository
- Define the patch boundary before granting write access
- Establish the baseline and required evidence
- Review the diff and the verification together
- Green tests cannot define the whole product contract
Here's the short answer to how coding agents work: a language model proposes an action, and a harness checks permissions, executes tools and returns the results for the next decision. The difference from autocomplete is who closes that loop. An agent can inspect files, edit code and run checks before handing the work back to me. I still treat the finished patch as a proposal. It is not proof of correctness.
I find model + harness + tools + environment + feedback a useful mental model. This breakdown of the coding-agent execution loop tells me more than whether the interface happens to look like a terminal or a chat window. I want to know where decisions happen, where execution happens and where I need controls. Those are the parts I can reason about separately.
What makes a coding agent different from a chat assistant?
A chat assistant gives you an explanation or a snippet, leaving you to apply it and test it. A coding agent gets a goal and can use repository tools to work toward that goal. This isn't simply a distinction between a good answer and a better one. The agent can inspect what happened after an action, then choose what to do next.
Take a failing authentication test. The agent might run it, read the output, find the relevant code, change it and rerun the check. If the failure changes, its next step can change as well. It doesn't have to generate a patch from the initial prompt and stop there; it can work from the evidence that comes back.
I'd look at that distinction before comparing models. What can the tool access? What can it execute, and how long can it keep going without approval? Those are my first questions. The answers make an agent's operating boundary much clearer to me than a product label does, especially when I'm deciding what authority to give it.
The harness turns model output into repository actions
The model reasons about the task and proposes the next action. By itself, though, it produces text. The harness is the program around it: it supplies tools, manages the context the model sees, enforces permissions and runs the interaction loop. I think that distinction is worth keeping explicit whenever we talk about what an agent “does.”
Tools expose the actions: read a file, edit it, search or run a shell command. The environment is where those actions actually execute. That might be a laptop, a container or a cloud sandbox. What comes back as feedback includes file contents, command output, errors and test results—the material the model has for its next decision.
This separation keeps me from taking a misleading shortcut and treating a capable model as a complete coding system. For local repository work, the model requests an operation; the harness decides whether to perform it. That is an execution boundary, not just a detail of the interface. It's where I'd start a safety review.
For the same reason, I'd start an implementation with a bounded tool rather than unrestricted terminal access. I want to be able to understand the permitted operation before making it convenient to use. That's my preference even if the broader interface looks easier to work with.
Context, action and verification form a repeating loop
The core workflow has three phases: gather context, take action and verify the result. Then repeat. I wouldn't read those phases as a fixed checklist that the agent completes once on its way to a final answer.
With a test failure, the first command establishes what is broken. The output helps the agent find the relevant files, and reading those files supplies context for an edit. Another test run gives it another piece of evidence. If a failure remains, the next move is back into investigation, not straight to a final answer claiming the work is done.
The plan can change during that process. An agent asked to add pagination might expect to edit an endpoint, then read the code and discover that queries belong in a shared repository layer. Now the plan is different. For larger tasks, a separate planning mode can give the agent room to investigate and propose changes before it starts editing.
I prefer that planning boundary when a requested change crosses responsibilities. In a newsroom CMS, for example, I'd want the proposed change to publishing behavior explained before accepting edits across the workflow. I want that chance to review the direction. It is a review choice, though, not a claim that having a plan guarantees a correct implementation.
What actually happens when an agent runs a command?
Tool calling is the connection between the model's request and executable code. First, the harness describes the available tools, including their names and input schemas. The model can then return a structured request rather than an ordinary answer. At that stage, we're still looking at a request, not an executed command.
For example, here is a command request in the Anthropic Messages API format:
{
"type": "tool_use",
"id": "toolu_1",
"name": "run_command",
"input": { "cmd": "python -m pytest -q" }
}
Nothing has executed at this point. The harness checks the request against its permission rules before doing anything with it. If the request is allowed, the harness runs the command and captures its output. It then sends back a result tied to the same request ID:
{
"type": "tool_result",
"tool_use_id": "toolu_1",
"content": "exit code 1\n2 failed, 1 passed",
"is_error": false
}
I'd read that result carefully. The tool returned test output; the tests did not pass. Successful delivery of a tool result and successful verification of a patch are two different things in this example, even though both can sound like “the tool worked.” I'd need my completion logic to preserve that distinction rather than blur it.
The interaction keeps going while the model requests tools. A normal response with an end-of-turn stop reason ends that interaction. I wouldn't read that signal as an independent quality check on the work. It tells me that the model has stopped requesting actions, which is a much narrower statement than “the patch is correct.”
Permissions separate approval from containment
Permission modes determine how freely an agent can act. The available approaches include read-only investigation, asking before actions and allowing edits while still requiring approval for broader operations. The exact boundaries vary between tools. I'd want to understand those boundaries rather than infer them from the name of a mode.
Approval policy and sandboxing are separate controls, and I keep them separate in my own thinking. The approval policy determines when the agent asks. The sandbox determines what the execution environment allows. Codex combines those settings rather than trying to express trust through a single switch. Asking and allowing are not the same decision.
An obviously destructive command isn't my only concern. A malicious file or web page can try to steer the agent into unwanted actions, too. A routine-sounding task wouldn't persuade me that the repository itself is trustworthy. With unfamiliar code, I'd use the same caution I use when handling untrusted repositories, rather than relaxing it because the requested fix looks ordinary.
I'd choose restricted execution and require explicit approval for broader access. Yes, more prompts can interrupt the work. I'd still rather adjust a narrow boundary deliberately than discover afterward that a convenient mode gave the agent more authority than the task needed. For me, that interruption is preferable to an authority boundary I haven't understood.
Putting a coding agent on an existing repository
For a maintained Node.js or TypeScript codebase, this is the rollout I'd use. These are my operating choices, not requirements imposed by a particular agent. The distinction matters: I'm describing how I'd bound and review the work, not a mandatory setup procedure.
Define the patch boundary before granting write access
I'd begin with a reproducible failure and name the behavior that must stay unchanged. For an authentication fix, that means explicitly keeping unrelated authorization changes outside the task. If I couldn't yet tell which area was affected, I'd ask for investigation first. I wouldn't treat uncertainty about the scope as permission to edit more broadly.
I'd then identify the permitted files and commands. My initial scope would leave out unrelated services, deployment operations and access to production credentials. Repository repair and releasing that repair would stay separate. I want the boundary to describe the work I'm asking for, not everything that might eventually happen after the patch is accepted.
Establish the baseline and required evidence
Before any edits, I'd have the agent run the relevant existing check and retain the failure output. After the edits, I'd ask it to run that same check again. Then I have something concrete to compare. A final statement that everything works isn't a substitute for seeing what failed before and what happened afterward.
For an editorial tool, I'd also spell out the behavior I want demonstrated: the intended action succeeds, and an action outside the user's permission is still rejected. I'd choose those checks to match the change. I don't want the agent quietly redefining success around whichever test happens to turn green while leaving the intended behavior unexamined.
Review the diff and the verification together
I'd inspect the implementation and any changed tests together. If a test passes because its assertion was weakened, that doesn't meet my acceptance criteria. The question I'd ask in review is whether the patch fixes the behavior I requested without moving the goalposts. A green result alone doesn't answer that question for me.
For the handoff, I'd require the changed files, the checks performed and any unresolved failures. If the agent gets stuck, I'd narrow the task or take over myself. I wouldn't keep widening permissions just to keep the loop moving. Continuing to act isn't, by itself, the outcome I'm trying to get from the agent.
Green tests cannot define the whole product contract
A coding agent can make the wrong change and still pass weak tests. Feedback helps it adjust, but that only makes the strength of the feedback more relevant. Tests, builds, linters and screenshots give different kinds of evidence. None of them makes the acceptance criteria disappear, and I wouldn't ask a green check to stand in for those criteria.
The patch I worry about is the one that satisfies the visible failure but misses the intended behavior. In a newsroom workflow, I care about who can publish and what happens to editorial state, not only whether a component renders. I'd keep those expectations explicit in the task and in human review, even if the visible failure seems narrower.
Permissions address a different problem. Restricting what an agent can do doesn't establish that an edit it is allowed to make is logically correct. The reverse matters too: a correct patch doesn't justify unnecessary access. I treat execution safety and code quality as separate review tracks because neither one settles the questions on the other track.
If all I needed was an explanation of a function, I wouldn't grant write access. For a bounded bug with clear checks, I'd use an agent to investigate, edit and verify. I'd give it enough authority to gather evidence and propose a repair, then keep acceptance of that repair with the maintainer. Before accepting it, I'd review the proposed diff alongside the checks performed and any failures still unresolved.
Sources
This is the source this article is based on. Many articles on this blog are drafted with AI and checked against their source automatically; the editorial policy explains how, and how to report a mistake.
Frequently asked
Can a coding agent run terminal commands on its own?
It can request terminal commands through a tool. The harness checks permissions, executes allowed requests and returns their output. Whether approval is required depends on the agent's configuration.
Does a coding agent need access to the whole repository?
Repository tools let an agent retrieve context on demand, but I would scope access to the task rather than assume unrestricted access is necessary. For an explanation-only task, I would start with read-only access.
Should I trust a coding agent when all tests pass?
Not automatically. A wrong change can pass weak tests. I would review the diff, check whether tests were weakened and verify that the requested behavior is actually covered.
Weekly newsletter
Liked this? Get the next one by email
One short email a week with new articles on React, Node.js, TypeScript and AI engineering. No spam. Unsubscribe in one click.
Further reading
Related tutorials from ByteMuni, my developer publication.
- Developer ToolsREA Setup Guide: Reverse Engineer Any App With Your AI Coding AgentREA lets your coding agent reverse engineer apps with Ghidra, Hopper and IDA. Here’s how to set it up in ten minutes, run your first investigation, and use it responsibly.
- AI AgentsAnatomy of an AI Agent Harness: Exploring Microsoft’s Agent FrameworkAgent design determines how models use tools, retain work and seek approval; this guide explains Microsoft defaults and safer Python file access.
- Developer ToolsDo You Need Coding Skills to Vibe Code? Programmer vs Non-Programmer You can build an app with AI and no programming knowledge, but shipping it safely is a different job. This guide compares a programmer and a non-programmer building the same product, walks through real incidents, and ends with a 10-point go-live checklist.