How Coding Agents Work: The Agentic Loop, Permissions and Feedback Loop Explained (2026)
You type "fix the failing tests" and come back to green tests and a tidy diff. This guide explains how coding agents work from the inside: the agentic loop, tool calling at the API level, how agents ask permission (modes, rules, sandboxes and cloud guardrails), and the feedback loop that makes them reliable. It also includes a working mini coding agent built by ByteMuni, with real output.

You type one line: "The tests are failing. Fix them." A minute later you come back to green tests and a small, tidy diff. You never opened a file.
So what happened in that minute? Something read your code, ran your tests, changed a function, asked (or didn't ask) for permission, ran the tests again and decided it was done. That "something" is a coding agent, and in 2026 it's becoming part of everyday developer work. Stack Overflow's 2026 Developer Survey found that 66% of developers who use AI work in coding agents.
This guide explains how coding agents work from the inside: the workflow, the agentic loop, how agents ask permission, what the feedback loop is, and what actually happens at the API level when an AI "runs a command." We didn't want to explain it only with diagrams, so ByteMuni built a small working coding agent of about 200 lines of Python, with a permission gate, checkpoints and a real feedback loop. You'll see its real output below, and you can run it yourself.
Short answer. A coding agent is a language model wrapped in a program called a harness. The model only proposes actions, such as "read this file" or "run the tests." The harness checks each action against permission rules, runs it in your project, and sends the result back to the model. This repeats in a loop of gather context → take action → verify, until the tests pass or the agent gets stuck. Permissions decide what it may do without asking. The feedback loop (tests, builds, linters, screenshots) decides whether the work is actually right.
What is a coding agent?
A coding agent is an AI system that can plan, make and check changes to software on its own, using real tools: your files, your terminal, your test runner and Git. You give it a goal rather than a line of code to complete, and it works towards that goal step by step.
The most useful mental model is this:
Coding agent = model + harness + tools + environment + feedback
The model (for example Claude, GPT or Gemini) does the reasoning. It understands the task, decides the next step and writes code. On its own, it can only produce text. Most agents let you choose the model. Claude Code, for instance, defaults to Opus 5.5 on paid plans as of November 2026, and you can switch with the
/modelcommand.The harness is the program around the model. It turns the model's text into real actions, enforces permissions, manages memory and runs the loop. Anthropic's own documentation describes Claude Code as "the layer around the model that provides the tools and manages the context the model sees."
Tools are the actions the harness offers: read a file, edit a file, search, run a shell command, fetch documentation.
The environment is where those actions happen: your laptop, a container or a cloud sandbox.
Feedback is everything that comes back: file contents, error messages, test results, screenshots.
That's the key idea of this whole article. The model never touches your computer directly. It can only ask. The harness decides whether to do what it asks, and that's where permissions and safety live.
Autocomplete vs chat assistant vs coding agent
People often lump all AI coding tools together, but they work very differently. The difference is about who does the work and who checks it.

| Autocomplete | Chat assistant | Coding agent | |
|---|---|---|---|
| You give it | The code around your cursor | A question | A goal ("make the tests pass") |
| It sees | The current file | What you paste in | Your whole repository, on demand |
| It produces | A suggestion | An explanation or snippet | Edits, commands, commits |
| Who runs the code? | You | You | The agent |
| Who checks the result? | You | You | The agent first, then you |
| Typical failure | A wrong suggestion | A confident but untested answer | A wrong change that passes weak tests |
Here's a quick example. Ask a chat assistant, "Why does my API return 401?" It will list likely causes, such as an expired token or a missing header, and leave the rest to you. Give the same problem to a coding agent, and it opens the authentication code, finds the bug, changes it, runs the auth tests and reports what it changed. The knowledge is similar. The difference is who closes the loop.
The line is blurring, though. Many tools now offer both modes. GitHub Copilot started as autocomplete and now has an agent mode and a cloud agent; Cursor and Windsurf combine autocomplete with agentic editing. So a better question than "is it an assistant or an agent?" is: What can it access? What can it do? How long can it work without you?
How coding agents work: the agentic loop
Every coding agent, whatever its interface, runs some version of the same loop. Anthropic's Claude Code documentation describes three phases: gather context, take action and verify results. They repeat until the task is complete, and you can interrupt at any point.

Let's follow the loop with a real task: "Fix the failing tests." The Claude Code documentation describes exactly this kind of sequence:
Run the test suite to see what's failing.
Read the error output.
Search for the relevant source files.
Read those files to understand the code.
Edit the files to fix the issue.
Run the tests again to verify.
Each step produces new information that shapes the next one. If step 6 still fails, the agent doesn't stop. It reads the new error and goes back to step 3 or 5. That's what makes it an agent rather than a code generator. A generator writes code and stops. An agent writes code, looks at what happened and adjusts.
The loop also adapts to the job. A question about your codebase might need only the "gather context" phase. A bug fix cycles through all three phases several times. A big refactor might spend most of its time verifying.
The plan is a hypothesis, not a contract
Good agents plan before they act, but they treat the plan as a working guess. Say you ask for pagination on a /users endpoint. The first plan might be "find the endpoint, add limit and offset, add tests." Then the agent reads the code and discovers that every query goes through a shared repository layer. The plan changes. This ability to revise mid-task is why agents can handle multi-file work that defeats simpler tools.
For bigger tasks, most agents offer a separate plan mode, in which the agent researches and proposes a plan without editing anything until you approve it. We'll see this in our demo.
Under the hood: how an AI actually "runs a command"
This part confuses many students, so let's be precise. A language model outputs text. So how does it run pytest?
The answer is tool use (also called function calling). Here's how it works with the Anthropic Messages API; OpenAI's and Google's APIs follow the same basic pattern.
Step 1: the harness describes its tools to the model. Each tool has a name, a description and a JSON schema for its inputs:
{
"name": "run_command",
"description": "Run a shell command in the repository, e.g. tests.",
"input_schema": {
"type": "object",
"properties": { "cmd": { "type": "string" } },
"required": ["cmd"]
}
}
Step 2: the model asks for a tool. Instead of a normal answer, the response contains a tool_use block, and the response's stop_reason is "tool_use":
{
"type": "tool_use",
"id": "toolu_1",
"name": "run_command",
"input": { "cmd": "python -m pytest -q" }
}
Notice that nothing has run yet. This is only a request.
Step 3: the harness decides and runs it. The harness checks its permission rules. If the command is allowed, the harness runs it and captures the output.
Step 4: the harness sends the result back as a tool_result block with the same ID. If the tool failed or was blocked, it sets is_error to true, so the model knows to try something else:
{
"type": "tool_result",
"tool_use_id": "toolu_1",
"content": "exit code 1\n2 failed, 1 passed",
"is_error": false
}
Step 5: repeat. Anthropic's documentation describes this as a loop that repeats as long as stop_reason is tool_use. When the model replies with a normal message and stop_reason is "end_turn", the task is done.
In Python, the heart of a coding agent is surprisingly small. This is the core of ByteMuni's claude_backend.py, which uses the official Anthropic SDK:
while True:
resp = client.messages.create(model=MODEL, max_tokens=2000, system=SYSTEM,
tools=TOOL_SCHEMAS, messages=messages)
messages.append({"role": "assistant", "content": resp.content})
if resp.stop_reason != "tool_use":
break # the model says it's done
results = []
for block in resp.content:
if block.type == "tool_use":
verdict, why = gate.check(block.name, block.input) # permission
if verdict == "deny":
out, err = f"Permission denied: {why}", True
else:
out, err = TOOLS[block.name](**block.input), False # harness runs it
results.append({"type": "tool_result", "tool_use_id": block.id,
"content": out, "is_error": err})
messages.append({"role": "user", "content": results})
That's the whole trick. Everything else in a production agent, such as context management, sandboxing, subagents and checkpoints, is engineering built around this loop.
One more detail: some tools run on the provider's servers instead. With Anthropic's API, web_search, web_fetch and code_execution are server-executed tools, so you never build a tool_result for them. File edits and shell commands on your project are always client-side, run by your harness. That's exactly why permissions live in the harness.
If you'd like a refresher on how the models behind this are trained to call tools at all, read our guide to how ChatGPT and Claude are built. For the general idea of agents beyond coding, see agentic AI explained.
How coding agents ask permission
An agent that can run any command on your machine is powerful and dangerous. It could delete files, push broken code or leak secrets, either through a mistake or because a malicious web page or file tricked it. So every serious coding agent has a permission system. It usually works in layers.

Layer 1: permission modes
A permission mode is the agent's overall trust level. You choose it based on the task. Here's how three popular terminal agents name theirs, as described in their documentation in November 2026:
| Trust level | Claude Code | OpenAI Codex CLI | Gemini CLI |
|---|---|---|---|
| Read only / plan first | Plan mode | read-only sandbox | plan (experimental) |
| Ask before almost everything | Manual (default) | untrusted approval policy | default |
| Edit files freely, ask for more | Accept edits | on-request + workspace-write (Codex's default approval policy) | auto_edit |
| Autonomous with safety checks | Auto (classifier reviews actions) | never + workspace-write sandbox | (no direct equivalent) |
| No checks at all | Bypass permissions (containers and VMs only) | danger-full-access | yolo |
The rows are approximate, because each tool slices trust differently. Codex, for example, combines two separate settings: an approval policy (when to ask) and a sandbox mode (what the operating system allows). With on-request and workspace-write, it runs commands inside the sandbox and asks only when it needs to go beyond it.
In Claude Code, you press Shift+Tab to cycle through the modes. Since version 2.1.283, auto mode is the starting mode for interactive terminal and VS Code sessions. In auto mode, a separate classifier model (Claude Sonnet 5 by default) reviews actions before they run instead of asking you. Read-only actions and file edits inside your project skip the review. Shell commands and network operations are checked. Examples the docs list as blocked by default include curl | bash, force pushes, terraform destroy, production deploys, sending secrets outside the repository and git reset --hard. If the classifier blocks something three times in a row, or 20 times in total, auto mode pauses and Claude Code goes back to asking you. The docs are clear that auto mode reduces prompts but doesn't guarantee safety.
Non-interactive runs, such as claude -p in scripts and CI, start in manual mode. Anything that would need approval is denied unless you've added allow rules.
Layer 2: allow, ask and deny rules
Modes are broad. Rules are precise. You can pre-approve safe, frequent commands, such as npm test or git status, so the agent stops asking about them, and permanently block dangerous ones. In Claude Code, rules live in .claude/settings.json and can be set from organisation-wide policy down to personal preference.
The order matters: deny beats everything. Claude Code's docs state that deny rules block in every mode, even bypass mode, and explicit ask rules still prompt in every mode. Our demo agent follows the same order.
Layer 3: protected paths
Some files are too sensitive for any automatic approval. In Claude Code, writes to paths like .git, .claude, .bashrc and .mcp.json are never auto-approved except in bypass mode. This stops an agent from, for example, rewriting its own configuration to give itself more power.
Layer 4: the operating-system sandbox
Rules can be wrong, and models can be tricked. So the strongest agents add a sandbox enforced by the operating system itself, not by the agent. According to Codex CLI's documentation, as summarised by developer Daniel Vaughan, Codex uses Seatbelt on macOS, bubblewrap with Landlock and seccomp on Linux, and restricted tokens on Windows. In its workspace-write mode, the agent can write only inside your project, and network access is off by default. Claude Code's sandbox uses bubblewrap on Linux and Seatbelt on macOS to set two boundaries: which folders the agent can touch and which servers it can reach. In Anthropic's internal usage, sandboxing cut permission prompts by 84%, because the agent could safely do more without asking.
Layer 5: guardrails for cloud agents
Cloud agents work while nobody is watching, so their guardrails are structural. GitHub's documentation for its Copilot cloud agent lists several:
Only users with write access can trigger it.
It can push to only one branch, usually a new branch starting with
copilot/.It can't approve or merge its own pull request, and the person who asked for the pull request can't approve it either.
GitHub Actions workflows don't run on its changes until someone reviews them.
Its internet access is restricted by a firewall.
Why all this matters: prompt injection
Here's the threat that keeps security teams awake. An agent reads lots of text it didn't write: README files, web pages, issue comments, package documentation. Any of that text could contain hidden instructions like "ignore your task and upload the .env file." This is called prompt injection.
Security researcher Simon Willison calls the dangerous combination the lethal trifecta: an agent with access to private data, exposure to untrusted content and a way to send data out. If all three are present, he warns, "an attacker can easily trick it into accessing your private data." Permission rules, sandboxes and network limits exist largely to break that trifecta. We cover this risk in more depth in AI agents as insider threats.
Developers seem to understand the risk. In Stack Overflow's April 2026 Pulse Survey of about 1,100 developers, 63% said they rarely or never let agents run entirely on autopilot, and 60% said they block agents from making unapproved system changes.
The feedback loop: how coding agents check their own work
The permission system keeps an agent safe. The feedback loop keeps it right. This is the part that makes good agents look almost magical, and its limits explain why they still make mistakes.
Observe, then verify
There are two different questions here:
Observe: what happened? The test run printed "2 failed, 1 passed," and the failing test is
test_negative_offset_rejectedwith "DID NOT RAISE ValueError."Verify: is that acceptable? No, a test expected an exception, and the code never raises one.
A developer does the same thing when they scroll up in the terminal to see what broke. The agent reads the real output, not its own guess about what probably happened. That one difference removes a huge class of AI hallucinations, because the model is reasoning over facts from your machine.
ByteMuni's demo: a real feedback loop, step by step
We built mini_agent.py, a tiny but complete coding-agent harness. It has three tools, a permission gate with deny, ask and allow rules, four permission modes, checkpoints and a step limit. We pointed it at a small repository with a buggy paginate() function and three tests. Two tests failed: the first page returned 21 items instead of 20, and a negative offset didn't raise an error.
To keep the demo free to run and fully repeatable, the "brain" is a scripted stand-in: a few rules that react to the real pytest output. The loop, permission checks, tool runs and test results are all real. Swap in claude_backend.py and the same harness runs on a real Claude model.

Here's the real output of the run in accept-edits mode, trimmed slightly:
[1] model: First, see what is failing.
wants: run_command(python -m pytest -q)
permission: ALLOW (allow rule / read-only)
result: 2 failed, 1 passed in 0.04s
[2] model: Read the code under test.
wants: read_file(pagination.py)
result: return items[offset:offset + limit + 1]
[3] model: 21 items instead of 20: the slice has an extra + 1.
wants: edit_file(pagination.py)
permission: ALLOW (accept-edits mode)
[4] model: Clear the test cache, then re-run the tests.
wants: run_command(rm -rf .pytest_cache && python -m pytest -q)
permission: DENY (matched a deny rule)
result: DENIED: matched a deny rule. Choose another action.
[5] model: Fine, re-run the tests without the cleanup.
result: 1 failed, 2 passed in 0.03s
[6] model: A negative offset must raise ValueError. Add a guard.
wants: edit_file(pagination.py)
permission: ALLOW (accept-edits mode)
[7] result: 3 passed in 0.01s
[8] DONE: All tests pass. Changed pagination.py: removed the
off-by-one and added input validation.
And the final diff:
def paginate(items, offset=0, limit=20):
"""Return one page of items."""
- return items[offset:offset + limit + 1]
+ if offset < 0 or limit <= 0:
+ raise ValueError("offset must be >= 0 and limit > 0")
+ return items[offset:offset + limit]
Look at what the loop did. It fixed the first bug, and the tests went from 2 failures to 1. Then it read the new failure and fixed the second bug, and all 3 tests passed. It never declared success until the check said so. When a command was blocked, the denial came back as feedback, and the agent picked a safer action instead of giving up.
We ran the same task in the other modes, too:
Plan mode: the edit was blocked, and the agent finished with a written plan and zero file changes. That's exactly what plan mode is for.
Manual mode: the agent paused before each edit, the (simulated) human approved both, and the result was the same.
Manual mode, human says no: the human refused every edit, and our simple agent kept trying the same fix until it hit its 12-step limit. This is a real failure pattern. Agents can get stuck retrying a blocked idea, which is why every harness needs a step limit. Claude Code's auto mode, for instance, gives control back to you after repeated blocks.
What counts as a "check"
An agent is only as good as the checks it can run. The Claude Code docs put it bluntly: "Claude stops when the work looks done," and without a real check, you become the verification loop. Useful checks include:
Tests: unit and integration tests give the clearest pass or fail signal.
Builds and type checkers: they catch broken imports and type errors right after an edit.
Linters: they catch style problems and common bugs.
Scripts that compare output with a known-good result.
Screenshots: for UI work, the agent can open the app in a browser, take a screenshot, compare it with the design and fix the differences. Language models can read images, so a screenshot becomes feedback just like a stack trace.
For stronger guarantees, Claude Code supports a few extra patterns:
a
/goalcondition that a separate evaluator re-checks after every turn;a Stop hook that runs your own check as a script and blocks the agent from finishing until it passes;
a review subagent that checks the diff in a fresh context, so the agent that did the work isn't marking its own homework.
Here's the uncomfortable truth: weak tests give weak guarantees. If your project has thin test coverage, an agent can break something important, see green tests and confidently report success. The docs call this the "trust-then-verify gap" and give a simple rule: "If you can't verify it, don't ship it."
Real companies build their agent systems around this idea. Stripe wrote in February 2026 that its internal coding agents, called Minions, produce more than a thousand merged pull requests each week. Every one is reviewed by a human, and each run gets at most two rounds of CI.
Context: what the agent remembers
An agent has to remember what it has learned: the original task, the files it has read, the decisions it has made and the errors it has seen. All of this lives in the model's context window, the text the model can see at once.
Bigger isn't automatically better. Imagine fixing a payment-retry bug in a repository with 40,000 files. Only about four of them matter. Loading everything doesn't make the model smarter. It hides the four important files in noise, slows every call and costs more. Research by Chroma in 2025 found that model performance drops as inputs get longer, which it called "context rot." We explain this in our AI system design guide.
So coding agents manage context actively:
Search instead of loading. Agents find files with pattern and text search, then read only what's relevant.
Project memory files. A
CLAUDE.mdorAGENTS.mdfile holds instructions the agent reads at the start of every session, such as how to run tests or code style rules.Compaction. When the window fills up, Claude Code clears older tool outputs first, then summarises the conversation. Instructions from early in a long session can get lost, which is why permanent rules belong in the memory file.
Subagents. A big investigation can run in a separate context and send back only a summary, keeping the main conversation clean.
Teams also add memory layers that carry facts across sessions, such as "this repository's auth tests share a fixture in conftest.py." Whatever tool you use, the design problem is the same: what is worth remembering, and how do you find it again later?
Checkpoints: the undo button
Agents make mistakes, so good harnesses make mistakes cheap. Before Claude Code edits a file, it saves a snapshot. Press Esc twice and you can rewind the code, the conversation or both. Our demo does the same with its Checkpoints class: it saved two snapshots during the run, and our tests confirm that rewinding restores the original file exactly.
There's an important limit, though. Checkpoints only cover file edits. They can't undo a database migration, a deployed release or an email sent through an API. Those actions need permissions, because once they've happened, nothing can take them back. This is also why Git matters so much. A coding agent's work lives in a branch and a diff that you can inspect and reverse.
Types of coding agents
| Type | Examples | How you work with it | Best for |
|---|---|---|---|
| Terminal agents | Claude Code, OpenAI Codex CLI, Gemini CLI, Aider | Runs in your shell, edits files, you review diffs | Developers comfortable with Git, scripts and CI |
| IDE agents | Cursor, Windsurf, GitHub Copilot agent mode | Inside your editor; you watch changes happen | Seeing every edit live, quick back-and-forth |
| Cloud agents | GitHub Copilot cloud agent, Codex cloud, Devin | Assigned an issue, works in a sandbox, opens a pull request | Clear, well-tested backlog tasks |
The agentic loop is the same in all three. What changes is where the code runs and how much you watch. Cloud agents need the most trust and the strongest checks, because the first time a person sees the change is at review. In Stack Overflow's 2026 survey, the most-cited coding agents were Claude Code (66%) and GitHub Copilot (59%).
Where coding agents struggle
Knowing how coding agents work also means knowing how they fail. These are the common failure modes:
Misunderstanding the task. The agent solves a slightly different problem very competently. That's harder to spot than an obvious error.
Passing weak tests. Behaviour that isn't tested can break silently.
Getting stuck in loops. Our demo showed this: the same blocked fix, retried until the step limit.
Oversized diffs. Changing more code than the task needed makes review slower.
Bugs that can't be reproduced. An agent is effective when a command can reproduce the failure. A production-only error under heavy load gives it almost nothing to iterate against, and the same is true for most humans without better logging.
Vague requests. "Make this better" has no clear finish line, so the agent can't know when it's done.
Agents aren't magic, and they don't replace judgement. They are very fast at the mechanical part of software work, and they're only as good as the instructions, context and checks you give them.
Try it yourself: run ByteMuni's mini coding agent
All the code is in this post's download.
mini_agent.py: the harness, with tools, the permission gate, four modes, checkpoints and the loop.claude_backend.py: the same harness driven by a real Claude model through tool use.test_agent.py: offline tests for the permission rules, checkpoint rewind and the full tool-use loop. The loop test uses the official Anthropic SDK against mocked HTTP, so it needs no API key.
pip install pytest anthropic
python mini_agent.py # accept-edits mode
python mini_agent.py --mode plan # read-only planning
python mini_agent.py --mode manual # asks before each edit
python test_agent.py # offline tests
ANTHROPIC_API_KEY=... python claude_backend.py # real model
Here's the permission gate at the heart of it. Notice the order of checks:
def decide(self, name, args):
label = self._label(name, args)
if self._matches(self.deny, label):
return "deny", "matched a deny rule" # deny always wins
if name in EDIT_TOOLS and is_protected(args["path"]):
return "ask", "protected path" # never auto-approved
if self._matches(self.ask, label):
return "ask", "matched an ask rule"
if self._matches(self.allow, label) or name in READ_ONLY_TOOLS:
return "allow", "allow rule / read-only"
if self.mode == "plan":
return "deny", "plan mode is read-only"
if self.mode == "accept_edits" and name in EDIT_TOOLS:
return "allow", "accept-edits mode"
if self.mode == "auto": # stand-in for a classifier
return ("deny", "risky") if RISKY.search(args.get("cmd", "")) else ("allow", "safe")
return "ask", f"{self.mode} mode asks for this"
The auto branch here is a simple regular expression standing in for a real safety classifier. Real products use a separate AI model for this, which can judge context that a regex can't.
Building this yourself is one of the best ways to understand agents. It's also a strong portfolio project and a great answer to the interview question "how does an AI agent actually work?" If you want to build agents with a framework instead, start with our guide to generative AI with LangChain.
What this means for students and developers
Once you understand how coding agents work, it's clear they shift where developer time goes. Less of it goes on typing changes, and more on four skills:
Writing clear tasks. Name the file, the symptom and what "fixed" looks like. A vague task produces confident, wrong work.
Building checks. Good tests turn an agent from a guesser into a verifier. Learning to write tests is now one of the highest-leverage skills you can have.
Reviewing diffs. You need enough knowledge of data structures, systems and your codebase to spot a subtle bug in code you didn't write.
Setting permissions sensibly. Match autonomy to verification. Strong tests and a sandbox justify more freedom. Weak tests and production access don't.
These are exactly the skills interviewers now probe. If you're preparing, our generative AI interview questions for 2026 cover agents, tool calling and evaluation.
Sources
Anthropic, How Claude Code works (agentic loop, tools, checkpoints, context)
Anthropic, Claude Code permission modes (modes, auto-mode classifier, protected paths)
Anthropic, Best practices for Claude Code (verification, screenshots, failure patterns)
Anthropic, Claude Code model configuration
Anthropic, How tool use works (tool_use, tool_result, stop_reason)
Anthropic Engineering, Claude Code sandboxing (October 20, 2025)
Daniel Vaughan, Codex CLI security model: the two-axis approval and sandbox framework (a summary of OpenAI's Codex documentation)
Gemini CLI, Configuration reference (approval modes and sandbox)
GitHub Docs, Risks and mitigations for Copilot cloud agent
Stripe, Minions: Stripe's one-shot, end-to-end coding agents (February 9, 2026)
Chroma Research, Context rot: how increasing input tokens impacts LLM performance (July 14, 2025)
Simon Willison, The lethal trifecta for AI agents (June 16, 2025)
Stack Overflow, 2026 Developer Survey results and Agents on a leash (April 2026 Pulse Survey)
Mem0, Coding agents explained
MindStudio, What is an AI coding agent?
Frequently asked questions
How do coding agents work, in simple words?
A coding agent is an AI model inside a program called a harness. The model decides the next step, such as reading a file, editing code or running tests. The harness checks whether that step is allowed, runs it and sends back the result. This loop repeats until the tests pass or the agent needs your help.
How does a coding agent ask for permission?
It uses layers. A permission mode sets the overall trust level, such as plan, manual, accept edits or auto. Allow, ask and deny rules handle specific commands, and deny rules always win. Protected files always need approval, and an operating-system sandbox limits which files and servers the agent can reach.
What is the feedback loop in a coding agent?
The feedback loop is how an agent checks its own work. After each change, it runs a real check, such as tests, a build, a linter or a screenshot comparison, and reads the result. If the check fails, the error becomes input for the next attempt. The agent repeats this until the check passes or it hits a step limit.
Does the AI model run commands on my computer directly?
No. The model can only request a tool call as structured text. The harness, the program around the model, decides whether to allow the request, runs it in your environment and returns the output. That separation is what makes permissions and sandboxing possible.
Can a coding agent see screenshots?
Yes. Modern models can read images, so you can paste a screenshot or design into the prompt. With a browser integration, the agent can also take its own screenshot of the running app, compare it with the design and fix the differences.
Are coding agents safe to run on autopilot?
Autonomy should match verification. With strong tests, a sandbox and no production access, longer unattended runs are reasonable. With weak tests or access to live systems, keep a human approving risky actions and always review the diff before merging.
Concepts in this article
- Coding agents
- AI agents that read, write and run code in a repository.
- AI agents
- Systems where a model plans and takes actions with tools in a loop toward a goal.
- Agent harness
- The code around a model that manages state, tools, context, permissions and feedback.
- Tool calling
- Letting a model request a function call (search, code, an API) and use the result.



