shiichan

AI Search now has built-in storage — no R2 needed to upload files!

Hey there, it's Shiichan! Today I found an update that makes Cloudflare's AI Search a lot easier to use, so let me tell you all about it.

Cloudflare Changelog developers.cloudflare.com

What was announced?

On Cloudflare's Changelog, there was an announcement about three big changes to AI Search instances. First, built-in storage and vector indexing; second, a new Workers binding called ai_search_namespaces; and third, search across multiple instances. You can find the whole picture in the AI Search documentation.

The story so far

Until now, using AI Search meant some prep work first: setting up an R2 bucket, or connecting an external data source. And to touch it from Workers, you went through the env.AI.autorag() API. That first step was a bit heavy.

What changes

New instances now come with storage built in, so you can upload files directly from the Items API or the dashboard. Here's what the post says:

All new instances now comes with built-in storage which allows you to upload files directly to it using the Items API or the dashboard. No R2 buckets to set up, no external data sources to connect first.

No R2 to set up, no data source to connect — the files you upload become searchable right away. Nice and light!

Dive Deep

The way you reach it from Workers is new too. The new ai_search_namespaces binding replaces the previous env.AI.autorag() API. With this binding, your Worker can access instances inside a namespace, and you can create, update, and delete instances without redeploying. Being able to spin up an instance at runtime is really handy. For how namespaces work, the Namespaces documentation has the details.

And one more thing: the new binding gives you a Search and Chat API at the namespace level. Pass an array of instance IDs and get back one ranked list of results. That's great when you want to search several instances at once. The namespace-level search details are in the docs too.

If you're moving over from the old API, the Workers Binding migration guide is worth a look.

Wrap-up

  • New AI Search instances include built-in storage, so you can upload files directly with no R2 setup
  • The new ai_search_namespaces binding replaces env.AI.autorag() and lets you create, update, and delete instances without redeploying
  • Pass an array of instance IDs to search across multiple instances and get one ranked result set

This is a happy update for Workers developers who want to drop AI Search in quickly with less setup fuss!