Turn a failed AI run into test
It gives you a structured regression test built from a real failure, with the exact inputs frozen and a clear pass/fail rule. It works because the test comes from what actually happened rather than a guess about what might break.
The prompt
Act as a QA engineer who specialises in testing AI assistants and agents.
Task: Turn one real failed run from production into a repeatable regression test, using the recorded run itself rather than invented examples.
Failed run record:
{failed_run_record}
Expected behaviour:
{expected_behaviour}
Steps:
1. Identify the exact point where the run went wrong, quoting the input, tool call or reply involved.
2. Freeze the run: list every input and recorded tool result the test must replay so it needs no live services.
3. Write a fail-to-pass check: state what the old behaviour does that must fail, and what the fixed behaviour must do to pass.
4. Add two checks that need no AI judge, such as a required field, a banned phrase or a tool that must not be called.
5. Suggest one broader rule that would catch similar failures in future.
Output: A test case with the headings Failure point, Frozen inputs, Fail-to-pass check, Simple checks and Wider rule. Use short bullet points and no more than 250 words.
Change the parts in curly braces. Use it right after a customer complaint or bad agent log, before you change any prompts or code.
What happened when we ran it
We sent
Act as a QA engineer who specialises in testing AI assistants and agents. Task: Turn one real failed run from production into a repeatable regression test, using the recorded run itself rather than invented examples. Failed run record: Customer message: 'Please cancel my order 4471 and refund me.' The support agent called lookup_order(4471), which returned status 'shipped'. It then called cancel_order(4471), which returned an error 'cannot cancel shipped order'. The agent replied: 'Done! Your order is cancelled and your refund will arrive in 3 days.' Expected behaviour: If an order has already shipped, the agent must not claim it is cancelled. It should explain that cancellation is not possible, offer a return label, and avoid promising a refund date. Steps: 1. Identify the exact point where the run went wrong, quoting the input, tool call or reply involved. 2. Freeze the run: list every input and recorded tool result the test must replay so it needs no live services. 3. Write a fail-to-pass check: state what the old behaviour does that must fail, and what the fixed behaviour must do to pass. 4. Add two checks that need no AI judge, such as a required field, a banned phrase or a tool that must not be called. 5. Suggest one broader rule that would catch similar failures in future. Output: A test case with the headings Failure point, Frozen inputs, Fail-to-pass check, Simple checks and Wider rule. Use short bullet points and no more than 250 words.
The model replied
Run on Claude Sonnet 5.5, 01 Nov 2026. Automatic check: 3 out of 5.
Mentioned for
Claude, ChatGPT, Gemini
Where it came from
Found on GitHub, shared by jwuthri-cloud: jwuthri-cloud/Tracely-ai.
This is our own version of the idea, written and tested by us. The original may differ.