Skip to main content
This guide builds a complete verification process: a customer submits a form and uploads a document (an ID card, an invoice, a certificate), and a workflow checks that the document matches the form. You will use: a datasource and file storage, a dynamic query, functions, an agent with a parser, a configuration, and a workflow run in the background.

1. Data

Two tables in your database: one for submissions, one for results.
Your application uploads the document to file storage (keeping the datasource:// reference) and inserts the submission through the datasource API.

2. A query that loads the submission

queries/submission_detail.yaml

3. Rules as a configuration

namespace

4. Functions

params: turns the submission_id variable into query parameters.
document-ref: picks the document’s path out of the loaded submission.
decide: compares the agent’s evidence with the form, using the rules.
result-row: shapes the result into a table row.

5. The workflow

workflows/document_verification.yaml
Points to notice:
  • The agent sees only the document (input_filter: [document_file]); it never sees the form, so it reports what is printed rather than what it expects.
  • The function decides, from the agent’s evidence and the configured rules, and returns reasons.
  • result re-emits the decision, so the run returns it rather than the insert’s confirmation.
  • The {{function:…}} placeholders are filled in by your deploy script.

6. Run it

Poll the execution until it is completed; your application then reads the decision from verification_results by submission_id.

7. Make it production-ready

  • Test with a genuine document and a mismatching one, and keep both as test cases.
  • Add a field_match router to refer submissions with no document instead of failing.
  • Add more agents in their own sub-workflows (a face check, a second document) and combine their evidence in decide.
  • Show the decision, reasons and evidence on the submission’s page, with the audit trail beside it.