Kissflow DocsCentro de ayuda
Este artículo aún no está disponible en español. Se muestra la versión original en inglés.

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.

Video: Evaluate agent quality

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

  1. Build a golden test set.
  2. Design outputs you can check.
  3. Run each case on the Draft.
  4. Record pass or fail.
  5. Fix the instructions and run the set again.
  6. Publish only when the set passes.
  7. 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}/test once per case with that case's InputData, 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 typeUse it forHow you check it
Yes/NoA decision or a rule check, such as "Total matches PO"Exact match with the expected answer
NumberAn amount, a score or a countExact match, or within a tolerance you choose
Text with a fixed vocabularyA category such as Low, Medium or High (define the allowed values in the instructions)Exact match
Reason (Text)A short explanation of the answerA 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 documentCompare 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}/test with that case's InputData (the same body as a normal run), use the returned ExecutionId to read GET /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.

FieldTypePurpose
Case IDTextA short name, such as INV-03
AgentTextWhich agent the case tests
Input descriptionTextWhat the input is, and why it is in the set
Input file or valuesAttachment / TextThe actual input
Expected outputTextThe answer you wrote before running
Actual outputTextWhat the agent returned
Reason returnedTextThe agent's Reason field
ResultDropdownPass or Fail
Run dateDateWhen you ran it
Instruction changeTextWhat 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.

OutputTypeDefinition
Invoice numberTextAs printed on the invoice, or "Not found"
TotalNumberInvoice total, no currency symbol
Matches POYes/NoYes only if the total equals the PO amount within 2%
ConfidenceNumber1 = guessed, 5 = every value clearly printed
ReasonTextOne sentence explaining the Matches PO answer

Here are five of the 15 cases in the Agent test cases dataform.

Case IDInputExpected outputActual outputResult
INV-01Clean one-page PDF, total 1,200.00, PO 1,200.00Total 1200, Matches PO YesTotal 1200, Matches PO Yes, Confidence 5Pass
INV-02Clean PDF, total 1,260.00, PO 1,200.00 (5% over)Total 1260, Matches PO NoTotal 1260, Matches PO No, Reason: "5% above PO"Pass
INV-03Blurry phone photo of an invoice, total partly unreadableConfidence 2 or lower; Reason explains that the total is unreadableTotal 7800, Confidence 5Fail
INV-04Invoice with no invoice numberInvoice number "Not found"Invoice number "Not found"Pass
INV-05A bank statement uploaded by mistakeInvoice number "Not found", Matches PO No, Confidence 1Matches PO YesFail

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.

An invoice agent form showing Invoice PDF, PO amount, PO currency and a returned invoice result

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.

En esta página