Evaluate agent quality
A repeatable method to measure whether an agent is good enough to publish, using a golden test set, typed outputs and run history.
An agent that works on one example can still fail on the next hundred. This article gives you a repeatable method to measure an agent before you generate it, and to keep measuring it afterward. You build a golden test set, run every case on the Draft, record the results in a dataform, fix the instructions, and repeat until the set passes.
Why measure at all
Agents read documents, reason and sometimes act through tools. They can misread a field, miss something, or be confidently wrong. Results can also vary slightly between runs. You can't remove that risk, but you can measure it. If you measure the same way every time, you can tell whether a change made the agent better or worse.
An agent has two versions, Draft and Live, and publishing replaces Live. A saved test set is your safety net: it tells you whether a new instruction broke something that used to work.
Note
Kissflow doesn't include a built-in test suite for agents yet, but you can ask AI Builder to build one into your app. The pieces it builds on are an example run you can start with Run the example, an API test route that accepts your declared inputs, separate Draft and Live versions, typed outputs, run statuses with error codes, and run history through the Agent API. The method in this article shows how they fit together.
The method
- Build a golden test set.
- Design outputs you can check.
- Run each case on the Draft.
- Record pass or fail.
- Fix the instructions and run the set again.
- Publish only when the set passes.
- Monitor after publishing, and re-run the set after every change.
1. Build a golden test set
A golden set is a fixed list of inputs, each with the answer you expect. Start with 10 to 20 cases as a suggested working set. Collect inputs from real work.
- Include ordinary cases that should pass easily.
- Include messy ones: a blurry scan, a missing field, an unusual layout, a second language, a document that is the wrong type.
- Include cases where the right answer is "not found" or "no".
- Write the expected output for each case before you run it, not after. Otherwise you will accept whatever the agent says.
Remove or mask personal and confidential details you don't need.
The set lives in two places, depending on its size.
- Examples in AI Builder. Start with the displayed examples and run them with Run the example. Use the API test route for cases with your own values. The example run shows its sample values on the card (Example 1, Example 2).
- A script for a larger set. For 10 to 20 cases or more, keep the cases in a file or dataform and write a script that calls
POST .../custom-agent/{AgentId}/testonce per case with that case'sInputData, then compares each output with your expected output.
2. Design outputs you can check
Free text is hard to score. Typed outputs are easy. Ask for these where you can.
| Output type | Use it for | How you check it |
|---|---|---|
| Yes/No | A decision or a rule check, such as "Total matches PO" | Exact match with the expected answer |
| Number | An amount, a score or a count | Exact match, or within a tolerance you choose |
| Text with a fixed vocabulary | A category such as Low, Medium or High (define the allowed values in the instructions) | Exact match |
| Reason (Text) | A short explanation of the answer | A person reads it on failed cases |
| Confidence (Number) | How sure the agent is, on a scale you define, such as 1 = guess, 5 = clearly stated in the document | Compare with the pass/fail result |
The Confidence number isn't a statistical measure. It is a field the agent fills in using your definition. Treat it as a hint for review, for example "send anything below 3 to a person", and check over time whether low scores line up with real mistakes.
Add the Reason field even if you don't plan to show it to users. Run results don't include the agent's working, so a Reason output is the easiest way to see why a case failed.
3. Run each case on the Draft
Both routes run Draft. Test tools act for real and can change real records.
- In AI Builder: open the Blueprint, select the Custom Agents tab, expand the agent's Instructions & example run, and click Run the example for the displayed examples. Use the API test route to test other input values.
- With a script: for each case, call
POST .../custom-agent/{AgentId}/testwith that case'sInputData(the same body as a normal run), use the returnedExecutionIdto readGET /agent/2/{AccountId}/application/{AppId}/custom-agent/{AgentId}/execution/{ExecutionId}until the status is Completed or Failed, and compare completed output with the expected output.
See Test an agent.
Important
A test run is a real run and uses real tools. If the agent has tools, they act for real. Test with data you don't mind changing, or use a version of the agent without write tools while you evaluate.
4. Record pass or fail
Record every result in a dataform so the set is easy to repeat, whether you ran the case from AI Builder or from a script. We suggest an Agent test cases dataform with these fields.
| Field | Type | Purpose |
|---|---|---|
| Case ID | Text | A short name, such as INV-03 |
| Agent | Text | Which agent the case tests |
| Input description | Text | What the input is, and why it is in the set |
| Input file or values | Attachment / Text | The actual input |
| Expected output | Text | The answer you wrote before running |
| Actual output | Text | What the agent returned |
| Reason returned | Text | The agent's Reason field |
| Result | Dropdown | Pass or Fail |
| Run date | Date | When you ran it |
| Instruction change | Text | What you changed before this run |
Your pass rate is the number of passes divided by the number of cases. Decide your bar before you start, for example "every case on the must-pass list, and at least 90% overall".
5. Fix and re-run
Look at the failures. Read the Reason field to see what the agent misunderstood. Then fix the instructions in the chat. Typical fixes:
- Define an output more exactly ("Mismatch: Yes only if the totals differ by more than 2%").
- Say what to do when information is missing ("return 'Not found' instead of guessing").
- Describe an input that the agent misread.
After every change, run the whole set again, not only the case that failed. A fix for one case can break another.
6. Publish only when the set passes
When the set meets your bar, click Generate. AI Builder creates and publishes agents when you click Generate; to change an agent later, see Change an app after it's generated. See Publish, Draft and Live.
7. Monitor after publishing
Real inputs will always be messier than your set.
- Check for Failed runs and their error codes. App Admins and Editors can list every run of an agent, newest first, through the Agent API. See Track runs and Troubleshoot agent errors.
- When a real input produces a wrong answer, add it to the golden set. The set should grow from real failures.
- Run the golden set again after every change to the instructions, and periodically even when nothing changed, such as once a month.
- Because there is no version history, keep a copy of the current instructions with your test set so you can restore a version that passed.
Worked example: an invoice checker
You built an invoice checker agent. It reads a supplier invoice PDF and the purchase order (PO) amount. It returns these outputs.
| Output | Type | Definition |
|---|---|---|
| Invoice number | Text | As printed on the invoice, or "Not found" |
| Total | Number | Invoice total, no currency symbol |
| Matches PO | Yes/No | Yes only if the total equals the PO amount within 2% |
| Confidence | Number | 1 = guessed, 5 = every value clearly printed |
| Reason | Text | One sentence explaining the Matches PO answer |
Here are five of the 15 cases in the Agent test cases dataform.
| Case ID | Input | Expected output | Actual output | Result |
|---|---|---|---|---|
| INV-01 | Clean one-page PDF, total 1,200.00, PO 1,200.00 | Total 1200, Matches PO Yes | Total 1200, Matches PO Yes, Confidence 5 | Pass |
| INV-02 | Clean PDF, total 1,260.00, PO 1,200.00 (5% over) | Total 1260, Matches PO No | Total 1260, Matches PO No, Reason: "5% above PO" | Pass |
| INV-03 | Blurry phone photo of an invoice, total partly unreadable | Confidence 2 or lower; Reason explains that the total is unreadable | Total 7800, Confidence 5 | Fail |
| INV-04 | Invoice with no invoice number | Invoice number "Not found" | Invoice number "Not found" | Pass |
| INV-05 | A bank statement uploaded by mistake | Invoice number "Not found", Matches PO No, Confidence 1 | Matches PO Yes | Fail |
INV-03 and INV-05 failed. Review the Reason output to check why the agent returned those answers. You tell AI Builder in chat: "If the total can't be read clearly, or the document isn't a supplier invoice, return 'Not found' for the invoice number, Matches PO No, and Confidence 1." Then you run all 15 cases again. INV-03 and INV-05 now pass, and so do the other 13. You publish.
Later, a Failed run with an error code about file size appears in the run history. Add that file as case INV-16 to check that the run fails as expected. For a successful run, supply a file within the size and page limits, then run the set again. Instruction changes do not raise file limits.

Keep in mind
- It doesn't prove the agent is right on inputs you haven't tried. A bigger, messier set gives you more confidence, never certainty.
- It isn't automatic. You run each example, or write a script that calls the API test route, and record the results yourself.
- For decisions about jobs, money, health, legal or safety, let the agent prepare and a person decide.

