Turn your agents' past mistakes into a test set to rerun when anything changes
Each time an agent in your routine gets something wrong, save the input and the right answer as a test case. Before you switch models, edit a prompt or add a tool, rerun the set and compare it with the last baseline.
How it works
- Make a test folder for one agent job you rely on, such as tagging journal trades, filing daily notes or checking a plan against your checklist. Each case is one file: the exact input, the answer you checked by hand, and a one-line note on what went wrong the first time.
- Whenever you catch that agent making a mistake, fix the job, then add the case to the folder before moving on. Add two or three cases where it did the job well, so you also notice when a change breaks something that worked.
- Freeze the inputs. Use saved copies of files and tool outputs, not live data, so a rerun tests the agent and not today's market.
- When anything changes (a new model, a provider switch, an edited prompt or rules file, a new tool or connector), a small script runs every case through the job and compares each output with the expected answer, using exact checks wherever possible: tags, counts, dates and numbers.
- The script reports passed, failed and changed cases against the last baseline, plus run time and cost, and saves the report with the date and a note of what changed.
- You decide whether the change stays. A case that used to pass and now fails blocks the switch until you've looked at it.
Copy-paste prompt
You run my private test set for one of my agent jobs. You do not give trading advice and you never comment on markets or securities.
Inputs: the test folder {{tests_dir}} (each case has input, expected_output and note), the job's current prompt and settings {{job_config}}, and the previous report {{baseline_report}}.
1. Run every case through the job exactly as configured, using only the saved inputs. Do not fetch live data.
2. Compare each output with expected_output. Use exact comparison for tags, counts, dates and numbers; for free text, check only the specific points listed in the case's note.
3. Report a table: case, pass or fail, and for failures the first point where the output differs.
4. At the top, under "regressions", list every case that passed in {{baseline_report}} and fails now.
5. Add total run time and, if available, cost, next to the baseline figures.
Do not edit expected outputs, and do not mark a case as passed because the output is "close enough".Guardrails
- You check the expected answers by hand, and the agent under test never edits them.
- Tests run on frozen copies of inputs, never on live account or market data.
- A regression on a case that used to pass blocks the change until you've reviewed it.
- The test runner reads files and writes a report. It has no broker access and never places orders.
What can go wrong
The set is only as good as its cases. Built from a week of runs that went fine, it passes everything and proves nothing. The useful cases are the embarrassing ones: the misread partial fill, the date in the wrong time zone, the tag the model invented. Free-text grading is the other weak spot. Asking a model whether an answer is "good" brings back the guesswork you were trying to remove, so keep checks to concrete points you can verify.
Why it helps
Agents change under you. A model update, a cheaper provider, a tidied-up prompt or a new connector can quietly break a job that worked last month, and in a trading routine the break usually shows up as a wrong number in your journal rather than an error message. A small set of cases you've already checked by hand turns "it seems fine" into a pass or fail you can see before the change goes live, and every mistake you catch makes the set a little stronger.
How it fits with other entries
The prove-it-runs check (aft-0036) tests a new script once, before you rely on it. This set keeps testing the agent job afterwards, every time something around it changes. The weekly agent audit (aft-0027) checks permissions and activity, the fallback routine (aft-0034) covers outages, and the cost ledger (aft-0040) can take its numbers from these reports when you're weighing a cheaper model.
Where this comes from
A public post by Neelesh (@gadi_neelesh) on X: keep the expensive failures as test cases, keep a second set of successes, and rerun both whenever the model or prompt changes. A post by @sk_learns makes a similar case for freezing a handful of golden tasks. The trading jobs, the frozen inputs and the blocking rule are our additions.
Source and references
Based on a public post by Neelesh (@gadi_neelesh) on X arguing that every costly agent failure should become a cheap test case, kept with a second set of good runs and rerun whenever the model, prompt or tools change. Applying it to a trader's own agent jobs, and the frozen inputs and exact checks, are our adaptation.
Original: Neelesh on x
- Post on turning agent failures into regression tests · Neelesh (@gadi_neelesh) on X (checked 19 Oct 2026)
- Post on freezing a few golden tasks to rerun after every change · Shubhranshu (@sk_learns) on X (checked 19 Oct 2026)
- Create strong empirical evaluations · Anthropic (Claude docs) (checked 19 Oct 2026)
- Regression testing · Wikipedia (checked 19 Oct 2026)
Spotted an error, or want your post removed? Email hello@agentsfortraders.com.
Educational content only. Not investment advice or a personal recommendation. No tickers, signals or trade alerts. Trading involves risk of loss.
Conteúdo exclusivamente educativo. Não constitui aconselhamento nem recomendação de investimento. Sem tickers, sinais ou alertas de negociação. Negociar envolve risco de perda.
Related use cases
Have one agent audit your other agents every week
A separate, read-only checker confirms that each of your agents actually ran, used fresh data, stayed inside its permissions and still follows its written rules. It reports; you save the evidence snapshot and fix what it flags.
Agent ops: guardrails & costsWrite a no-AI fallback for your routine before your model provider goes down
For each step of your routine that an agent runs, write down the manual version and how you'll know the step failed, and keep a tested second provider for the steps you rely on most. An outage then costs minutes, not your process.
Agent ops: guardrails & costsMake your agent prove a new script works by running it, not describing it
When an agent builds or changes a tool you rely on, such as a sizing calculator or a journal stats script, finish by having it run your real command on hand-checked test cases and show the raw output against your expected numbers.
Agent ops: guardrails & costsKeep a monthly cost-and-value line for every agent in your trading routine
Once a month, list each agent job with what it cost (plan share, API spend, minutes fixing it) and the value it delivered, measured in minutes saved and checks it caught, never trading profit. Then keep, fix or switch off each one.
The Daily 3
Three agent workflows for swing traders, free, on US trading days.