Course lesson 28 · Building AI Workflows
Workers AI & AI SDK
This lesson introduces Workers AI as the model service and the AI SDK as a common interface for calling providers. The key design choice is structured output: instead of interpreting a free-form paragraph, application code receives named fields whose shape is described by a schema. The forthcoming destination checker will use that approach to turn scraped content into a status the rest of the application can consume.
Primary source: course video 28 · Supplied English subtitles · 00:06:46.
Understand the idea
- Workers AI is presented as Cloudflare-hosted models reached through an environment binding.
- Different models offer different capabilities, context sizes, costs, and latency; the feature must fit the chosen model.
- A response schema describes object fields, their types, required properties, and possible enumerated values.
- System instructions, user content, and the requested output shape each contribute to the model call.
- The AI SDK provides a common calling pattern across providers, which makes comparison and substitution easier.
What the course does
- Review the model catalogue and focus on support for the structured response needed by the application.
- Compare a free-form answer with the example object containing a country’s name, capital, and languages.
- Inspect how the example schema specifies strings, an array, and required fields.
- Consider comparing two model outputs within separate workflow steps as a possible extension.
- Review the AI SDK’s provider abstraction before implementing the checker.
- Inspect the minimal Workers AI binding and run pattern that the provider integration will build upon.
Watch for
- The model list and supported capabilities shown in the recording are time-sensitive.
- Added advice: JSON syntax, schema conformity, and factual correctness are separate properties; do not treat structured output as proof of a correct classification.
- The instructor’s claims about which organisation pioneered an output format are background commentary, not required knowledge for this application.
Follow the final workflow correction in lesson 34 when combining these steps.
Recall before revealing
What problem does a response schema solve, and what does it leave unsolved?
Reveal the explanation
It makes the output shape usable by application code; it does not ensure the model understood the page or chose the correct status.
Try it
Define a small destination-check result with a status and a reason. Explain which values should be allowed when the evidence is incomplete.
Check your result
Your design represents uncertainty explicitly and does not require fragile string searching through a paragraph.
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.
- 00:00:38 — Workers AI as the course model service
- 00:01:22 — Why structured responses help application code
- 00:02:28 — JSON response schema example
- 00:04:23 — AI SDK provider abstraction
- 00:05:44 — Workers AI binding and model invocation
Companion primary documentation: Workflows Workers API. For recorded API names, commands, limits, and prices, check the version you use.