Knowledge tree
Offensive Security
Shells
File Transfer
Web Applications
Agent Loop
An agent loop repeats a simple sequence: observe the current state, choose the next step, act, receive the result, and decide again.
What makes it useful is that the result changes what happens next. The complete path is not fixed in advance.
Coding-agent example
An agent is asked to fix a failing test:
- It runs the test and observes the error.
- It reads the test and related code.
- It edits a file.
- It runs the test again.
- If it still fails, the new error determines what to inspect next.
- If it passes and the task is complete, the agent stops.
The agent did not need to know in advance how many files it would inspect or how many test runs would be required. Each result informed the next action.
Tools and execution
The model does not normally change the environment itself. It proposes a tool call and the harness performs the operation: read a file, edit code, or run the test. The result returns to the model as a new observation.
One tool call does not automatically make an application an agent. It may be one step in a fixed sequence. A loop exists when the system decides again from the result and can change direction.
Stopping
The loop needs a useful completion condition. In the example, a passing test is not enough if the task also requires a successful build. The success condition includes all requested validation.
The loop can also stop because it needs a user decision, an action requires approval, or no safe progress is possible. Repeating the same failing command without changing anything is not progress. The result should lead to a different hypothesis, a request for help, or a stop.
Fixed workflow versus agent loop
In a fixed workflow, the stages are already known: parse a file, validate its schema, then store it. In an agent loop, the model chooses among available actions according to what it finds.
Both can work together. The agent chooses to run the tests, while the test runner remains deterministic software with predefined behavior.
Tool Use covers how a tool call executes. Agent Harness covers the program that maintains this loop.