Skip to content
Twenty One Media
aiNovember 20, 2026

Testing the AI Step Is Different Than Testing the Rest

When we add an AI step to an automation, the testing question changes.

A standard n8n workflow is deterministic: given the same inputs, it produces the same outputs. You can assert an exact value. The Airtable field equals "Approved". The email subject contains the job number. The webhook returns a 200 with the expected shape. Write the assertion, run the test, it passes or it fails.

An AI step doesn't work that way. Ask Claude to draft a session note from an IFSP goal record and you'll get a slightly different draft every time. That's the point. You can't assert the exact text.

So most people skip the test. That's the wrong move.

What you can test

The AI step is in the middle of a pipeline. It has inputs and it has outputs. Both of those are testable, and they're where the real validation lives.

On the input side: did the step receive the data it needed? The Freedom Ag spray card generator reads three things from the database before it writes anything: the product record, the label rate for that crop and application type, and the job record from the work order. We can assert that all three calls succeeded and returned populated records. If any of them returned empty, the AI step didn't run. That test catches the class of error that produces hallucinated rates, which is the only error on a spray card that creates a compliance problem.

On the output side: did the step write a valid structured record? The spray card generator writes a job record with specific fields: product name, rate with unit, field block, applicator, job number. We can assert that every required field is present and non-empty. We can assert the product name matches the product record it read. We can assert the rate is a number within the valid range for that application type. We're not testing what the AI wrote; we're testing that it wrote within the expected shape.

This is the distinction: test the data layer that feeds the AI and the structured output it produces. Don't try to test the prose.

The Homefront version of this

The session note assistant reads one record at the start of every session: the specific child's current IFSP goals. We test that the goal record was read and that it included at least one active goal. We test that the note draft references the goal ID. We don't test that the phrasing is correct, because that's what the provider reviews before they sign off.

That's the other piece of this: the human review gate handles the quality check that automated testing can't. The automation test handles the structural check that the human shouldn't have to do manually.

When a test catches a real problem

Three months into the Freedom Ag build, an applicator logged a job with a product that had recently been reformulated. The catalog record existed but the label rate table hadn't been updated yet for the new formulation. The spray card generator called the catalog, got the product record, called the label rate table, got an empty result for that crop and application type combination, and stopped the workflow with an error. The applicator got an alert. No spray card was generated from missing data.

That's the test earning its keep: not asserting that the AI wrote something beautiful, but asserting that the data it needed was there before it ran.

The pattern

For any AI step in a production workflow: write assertions for the function calls that feed it and the structured fields it writes. Keep the review gate for the prose. The two layers handle different classes of error, and both need to be there.