A First Coding-Agent Workflow: Explain, Fix, Test, Review
A working API connection is only the beginning. This small exercise shows how a developer, student, or startup team can give an agent a precise task, review its plan, and verify the result independently.
Use Hermes, OpenCode, or Aider after its plain-chat check succeeds. 9Router is a gateway, not a coding agent; it is optional infrastructure between your client and AvalAI.
1. Create two disposable files
Use a new empty directory outside your real repository. You need Python 3.10 or newer, but no third-party packages. Do not attach customer data or environment files.
Save the deliberately incomplete implementation:
def total_cents(prices):
return sum(prices)Save the independent acceptance tests:
import unittest
from totals import total_cents
class TotalsTests(unittest.TestCase):
def test_empty(self):
self.assertEqual(total_cents([]), 0)
def test_integer_cents(self):
self.assertEqual(total_cents([125, 250]), 375)
def test_negative_rejected(self):
with self.assertRaises(ValueError):
total_cents([125, -1])
def test_fraction_rejected(self):
with self.assertRaises(ValueError):
total_cents([1.5])
def test_boolean_rejected(self):
with self.assertRaises(ValueError):
total_cents([True])
if __name__ == "__main__":
unittest.main()This toy function adds integer cents; it is not a production accounting system. The missing behavior is input validation.
2. Establish the baseline yourself
python3 -m unittest -v test_totals.pyExpected baseline: five tests run; three fail because negative values, fractions, and booleans are accepted. The empty-list and normal sum tests pass.
A failing baseline is useful evidence. Do not let the agent weaken the tests just to make the result green.
3. Ask for a read-only plan
Open your configured agent in this disposable directory and submit:
Read only totals.py and test_totals.py.
Explain why the tests fail. Propose the smallest fix, but do not edit yet.
The contract is: integer cents only, no negative values, no booleans,
empty input returns 0, invalid input raises ValueError.
Do not install packages, read secrets, access the network, or change tests.Approve only reads of these two files. Check that the proposal identifies Python's bool/integer relationship and preserves valid integer sums.
In Aider, begin with the guide's --chat-mode ask settings and add these two files instead of README.md. In OpenCode, retain approval prompts. In Hermes, review its active tool permissions. Tool controls differ; a prompt alone is not a sandbox.
4. Approve one bounded edit
When the plan matches the contract, explicitly allow the edit:
Approved: edit only totals.py to satisfy that contract.
Do not change test_totals.py or other files.
Stop after the patch and report what changed.
Do not commit, push, deploy, or claim tests ran unless you actually ran them.In Aider, switch to code mode with /chat-mode code for this approved step, keeping automatic commits disabled. For the other agents, approve only the relevant file edit. Do not grant broad shell or network access to make a small fix work.
5. Verify independently
Run the same command yourself:
python3 -m unittest -v test_totals.pyExpected result after a correct fix: five tests pass. Inspect both files and confirm the tests are unchanged. If working in a Git repository later, also inspect git diff and git status --short.
A useful review receipt is:
Scope: totals.py only
Behavior: accepts nonnegative integer cents; rejects negatives, fractions, booleans
Evidence: python3 -m unittest -v test_totals.py
Result: 5 tests passed
Unchanged: test_totals.py
Not done: commit, push, deployDo not copy that receipt as proof; fill it from the commands and diff you actually inspect. If a test still fails, send the minimal failure and request a revised plan. Do not send a full environment dump or unrelated private files.
6. Apply the pattern to real work
| Audience | Small first task | Acceptance evidence |
|---|---|---|
| Developer | Fix one validation bug | Reproduction test, minimal diff, relevant suite |
| Startup | Add one CSV import rule | Synthetic valid/invalid rows, no customer data |
| Student | Explain a function, then attempt your own fix | Your explanation and tests; follow course rules |
| Company team | Review one module without edits | File/line evidence, limitations, human decision |
Define the scope, tests, stop condition, and permissions before starting. Give each task a request/time budget; inspect AvalAI usage because agent loops and retries can add cost. Do not assume an upstream SDK's dollar-budget option works through every AvalAI client.
For longer work, keep a short task record with current files, decisions, evidence, and remaining questions. Start a fresh session when the context becomes noisy. A resumed session is not independent verification; rerun the checks against current files.
Sources and limits
Reviewed on 2026-09-08. Adapted from the official OpenAI Cookbook and openai/openai-cookbook, particularly iterating development workflows, and the Claude Cookbooks repository reviewer.
The adaptation keeps bounded reads, explicit approval, and evidence. It does not install the Claude Agent SDK, run a scheduled reviewer, or claim hosted agent features are AvalAI APIs. The sample's Python behavior can be checked offline; no live coding-agent session or paid model call was performed for this publication.