Course lesson 29 · Building AI Workflows

Create an AI Workflow Step

One study unit · Read, recall, then practice · Original video 00:21:52

The course implements an AI destination-checking helper with a Zod output schema, the Workers AI provider, and the AI SDK’s recorded generateObject API. The helper receives extracted page text and returns an availability status plus a concise reason, and a new workflow step calls it with a restrained retry policy. Testing reveals an important limitation: a more detailed prompt still produces an unknown result when the collected page content is incomplete or unexpected.

Primary source: course video 29 · Supplied English subtitles · 00:21:52.

Understand the idea

What the course does

  1. Create the AI helper and define its status-and-reason output schema.
  2. Add the AI binding, regenerate types, and configure the Workers AI provider.
  3. Call the structured-output API with a supported model, instructions, the extracted body text, and the schema.
  4. Add an AI workflow step with a deliberately limited retry policy.
  5. Test an unavailable AliExpress listing: the first run reports unavailable, though its explanation is not the expected evidence.
  6. Strengthen the prompt and rerun; the result becomes unknown, motivating storage of the actual scraped input for diagnosis.

Watch for

Follow the final workflow correction in lesson 34 when combining these steps.

Recall before revealing

Why is the unknown result useful evidence rather than simply a failed prompt?

Reveal the explanation

It can indicate that the model was given missing or different page content; the pipeline must inspect its input before blaming the model.

Try it

Write three short page-text samples: clearly available, clearly unavailable, and missing product information. State the expected status and supporting phrase for each.

Check your result

Your expected results distinguish uncertainty from unavailability and can be used as a small repeatable evaluation set.

Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.

Rewatch only what you need

Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.

Companion primary documentation: Workflows Workers API. For recorded API names, commands, limits, and prices, check the version you use.

← Previous   Next →