Course lesson 31 · Building AI Workflows

Saving Web Page Data in R2

One study unit · Read, recall, then practice · Original video 00:15:36

The workflow backs up rendered page evidence to R2 and links it to the evaluation saved in D1. The lesson explains why relational records belong in a database while larger documents and images fit object storage, then uses a shared evaluation ID to connect those two kinds of data. Inspecting the stored AliExpress text confirms that the renderer did not collect the expected product information, giving a concrete reason to improve observability.

Primary source: course video 31 · Supplied English subtitles · 00:15:36.

Understand the idea

What the course does

  1. Enable R2 in the course account and create a staging evaluation bucket with standard storage.
  2. Add its binding and bucket name to Wrangler, then regenerate environment types.
  3. Use the evaluation ID returned by the preceding database-save step to build the evidence paths.
  4. Write the rendered HTML and extracted body text to separate R2 objects.
  5. Deploy and trigger a workflow; check both the new D1 record and the corresponding R2 objects.
  6. Download the text and HTML to investigate why the model returned unknown for the AliExpress page.

Watch for

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

Recall before revealing

How can a database query lead to the exact evidence objects for an evaluation?

Reveal the explanation

The evaluation’s ID and account identify the object-key pattern, so query results provide the information needed to retrieve those objects.

Try it

Design key names for one evaluation’s HTML, text, and screenshot, then write the minimum database fields needed to locate them.

Check your result

All three objects are unambiguously associated with the same evaluation and can be located without scanning their contents.

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 →