How I work with AI agents
- AI
- Agents
- Workflow
This is my setup and what I learned from it. It isn't a standard, just what works for me. I presented it to engineers at in-tech as part of my AI Multiplier role. Take what fits your work.
How I got here
The task: migrate a backend to a new AWS repository. Every feature, every small detail had to work exactly as before.
The constraint: halfway through the migration, our AI usage got a monthly budget cap. Using the strongest model for everything burned through it in about 8 working days.
The discovery: Sonnet testing its own work did the job for far less budget.
My takeaway: for my tasks, an agent checking its own work mattered more than model power.
The condition for all of this: tests
Everything below depends on one thing: the agent must be able to prove its work is right.
Without solid unit and integration tests, a cheaper model in a loop just makes confident mistakes cheaply. In that case a stronger model is the safer choice. Weak tests? Fix them first.
My six defaults
These are the most important part. They need no process and fit almost any team.
- A slim instruction file: architecture, style, boundaries.
- Sonnet at high reasoning, and a stronger model only when stuck.
- The agent tests its own work before it says done.
- One task, one session.
- MCP for Jira and Confluence, and unused servers turned off.
- A review skill before every PR, then human review focused on risk.
Let the model test its own work
My verification loop is simple:
- Write the change.
- Run the unit and integration tests.
- Call the real API in the dev environment (through Swagger) and read the real response.
- Fix and run again.
Unit tests prove the logic, fast and cheap, on every change. Integration tests prove the behavior end to end and show that nothing old broke. No task is done without a green run.
A green run only counts if the tests weren't weakened to get there. Deleting a test, adding .skip, loosening an assertion or updating a snapshot to match new output always gets flagged for a human. Bugs start with a failing test: it fails before the fix and passes after.
The loop also needs a stop condition. If the same test still fails after 3 attempts, or 5 rounds pass without progress, the agent stops and reports blocked instead of burning tokens on retries.
Think once with the strong model, loop with Sonnet
| Model | Runs | |
|---|---|---|
| Find the intent: understand the code and the business logic, decide the architecture, write the spec and a short summary file | Opus, or Sonnet at max reasoning | Once |
| Implement in a loop: read the summary, implement, test until it works | Sonnet, new session | Many times |
The loop is where the tokens go. On my tasks, running the loop on Opus cost much more without a clear gain. I spend the strong model on thinking, not on retries.
One task, one session. Context lives in the repo
Why a new session per task: every turn resends the whole chat. Long sessions get slower, more expensive and less accurate. A new session starts clean from the summary file.
How I share context: one folder per epic, committed with the code:
docs/context/<EPIC_KEY>/
intent.md goal, constraints, open questions
decisions.md one to three lines per decision
spec.md written once the intent is clear
tasks.md small tasks, each fitting one session
Any developer or agent can continue where someone else stopped. If context lives only in your session, your teammates and their agents start from zero.
But sharing context has a cost, so know the tradeoff first:
- What you gain: anyone can continue, nobody re-explains, and reviewers know what "correct" means.
- What it costs: time to write and update the files, discipline under deadline, and the risk that stale files mislead every agent.
- Worth it for epics, long running features and work shared by several developers. Skip it for anything that fits in one session.
MCP instead of copy and paste
- Read only what the task needs. The agent fetches one ticket or one page, not whole documents pasted into chat.
- Writes go through the engineer. Jira comments, status changes and Confluence edits are drafted by the agent and sent only after approval.
- Unused MCP servers cost tokens too. Every enabled tool's description is sent with each request, so I disable the servers a repo doesn't use.
A slim main instruction file
It holds the architecture rules, the coding style of the repo, the main boundaries (what may talk to what) and how to run the tests.
It stays short because it loads on every turn. Short rules cost less and get followed better. Task details belong in context files and skills.
New features don't break old ones because three things work together: architecture rules in the instruction file, the full test suite on every change, and a review skill that checks the diff against those rules.
Skills for the work I repeat
- Review (the most important one): a fresh session that sees only the spec and the diff. It checks the architecture rules, tries to break the change instead of approving it, and writes a short risk summary.
- Commit and PR: message, title and body in the repo's existing format.
- Jira update: comment and status drafted, sent after approval.
Skills give consistent results on a cheaper model, without rewriting the prompt every time.
Agent loop or human approval?
The agent loops on its own: implementation from a confirmed spec, unit and integration tests, refactors covered by tests, parity checks in migrations, commit and PR text.
A human approves: intent and spec, architecture changes, auth and security, data migrations, public API changes, writes to Jira and Confluence, and the merge.
My rule of thumb: if tests can prove it's right, the agent loops. If it's a decision about what to build, or hard to undo, a human approves.
One short report at the end of the task
Agents love long walls of text. I ask for one short report, once, at the end:
Status: done | blocked | needs your decision
Changed: three lines at most
Verified: tests run, results
Not verified: what and why
Assumed: choices made alone
Needs you: options + recommendation
Risks: only real ones
Details: link to PR or decisions
Decisions come first, so I know in seconds whether I need to act. Details are linked, not repeated. And nothing hides: "Not verified" is required every time.
What it delivered for me
- 8 → 20 working days: the monthly budget now lasts the full month.
- ~75% of the cap used per month, with budget to spare.
- 92% test coverage on the new backend service.
- Code quality held up in my reviews, though I haven't measured it formally yet.
To be honest about the limits: this is one developer on one project with a strong test reference. Heavy months can still hit 100%.
What worked for me
My six defaults. Context sharing when the work needs it. Tests before everything.
Take what fits your work, and tell me what you'd change. You can reach me on LinkedIn.