Skip to content

feat: add ai_search_namespaces and ai_search binding types#13027

Merged
petebacondarwin merged 4 commits intocloudflare:mainfrom
G4brym:gmassadas/ai-search-binding-wrangler
Mar 27, 2026
Merged

feat: add ai_search_namespaces and ai_search binding types#13027
petebacondarwin merged 4 commits intocloudflare:mainfrom
G4brym:gmassadas/ai-search-binding-wrangler

Conversation

@G4brym
Copy link
Copy Markdown
Member

@G4brym G4brym commented Mar 23, 2026

Summary

Add two new AI Search binding types to Wrangler, Miniflare, and workers-utils:

  • ai_search_namespaces: namespace binding — namespace name is required, provisions automatically at deploy time (like R2 buckets) if it doesn't exist
  • ai_search: single instance binding — bound directly to a pre-existing instance in the default namespace

Both binding types are remote-only in local dev (Miniflare proxies to the remote API).

Changes

workers-utils:

  • Config schema, runtime types, metadata/binding unions, validation, defaults, reverse mapping
  • ai_search_namespaces.namespace is required (type + validator in sync)

wrangler:

  • Upload form with INHERIT_SYMBOL/dryRun handling
  • Provisioning handler for ai_search_namespaces — checks for HTTP 404 before provisioning (same pattern as R2)
  • AI Search namespace API helpers (getAISearchNamespace, createAISearchNamespace)
  • Print bindings, config diffs, dev utils, miniflare mapping

miniflare:

  • Schema-only plugin with remote proxy for local dev

  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: docs will only be added when we announce the new binding

A picture of a cute animal (not mandatory, but encouraged)

portuguese water dog, aka the obama family dog
image


Open with Devin

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 23, 2026

🦋 Changeset detected

Latest commit: b35c8f2

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 23, 2026

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@13027

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@13027

miniflare

npm i https://pkg.pr.new/miniflare@13027

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@13027

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@13027

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@13027

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@13027

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@13027

wrangler

npm i https://pkg.pr.new/wrangler@13027

commit: b35c8f2

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch from 092ea72 to 4425684 Compare March 23, 2026 18:53
@G4brym G4brym marked this pull request as ready for review March 23, 2026 19:08
@G4brym G4brym requested a review from a team as a code owner March 23, 2026 19:08
@workers-devprod
Copy link
Copy Markdown
Contributor

workers-devprod commented Mar 23, 2026

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 3 times, most recently from 78ed937 to 45ee84b Compare March 23, 2026 20:33
devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch from 45ee84b to 64e7ded Compare March 23, 2026 21:47
devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 6 times, most recently from 1315e92 to 52a0d3b Compare March 23, 2026 22:49
devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 2 times, most recently from 9be3ffc to f3cfb67 Compare March 23, 2026 23:26
devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym marked this pull request as draft March 25, 2026 15:25
@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 3 times, most recently from 7e67fab to 10bccfd Compare March 25, 2026 20:50
@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 3 times, most recently from daa9a7d to 519bed5 Compare March 25, 2026 20:54
@G4brym G4brym marked this pull request as ready for review March 25, 2026 21:42
devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 3 times, most recently from 7f6cb6f to 7097522 Compare March 25, 2026 22:16
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @G4brym - nice work on this. I have added a load of comments (sorry) but also I would really like there to be an e2e test (perhaps in a remote binding test) that demonstrates that the deployment of the remote binding is functional in practice.

@github-project-automation github-project-automation bot moved this from Untriaged to In Review in workers-sdk Mar 26, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@G4brym G4brym force-pushed the gmassadas/ai-search-binding-wrangler branch 3 times, most recently from 9c91fa4 to 93fb683 Compare March 27, 2026 09:41
G4brym and others added 3 commits March 27, 2026 10:14
Add two new AI Search binding types to Wrangler, Miniflare, and workers-utils:

- ai_search_namespaces: namespace binding with dynamic instance CRUD
- ai_search: single instance binding bound to one instance in a namespace

Both are remote-only in local dev. Namespace auto-creation during deploy
follows the R2 bucket provisioning pattern — checks for HTTP 404 on the
namespace API before deciding to provision. The namespace field on ai_search
defaults to 'default' if omitted.

Changes across 3 packages:
- workers-utils: config schema, runtime types, metadata/binding unions,
  validation, defaults, reverse mapping
- wrangler: upload form with INHERIT_SYMBOL/dryRun handling, provisioning
  handler, API helpers, print bindings, config diffs, dev utils, miniflare mapping
- miniflare: schema-only plugin with remote proxy for local dev
@petebacondarwin petebacondarwin force-pushed the gmassadas/ai-search-binding-wrangler branch from 93fb683 to 982f9e7 Compare March 27, 2026 10:15
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Let's land this.
I have run the remote binding tests locally using our Dev Prod Testing account (since this is on a fork and can't run here). Also @G4brym has run them locally too using his account.

@github-project-automation github-project-automation bot moved this from In Review to Approved in workers-sdk Mar 27, 2026
@petebacondarwin petebacondarwin merged commit 9fcdfca into cloudflare:main Mar 27, 2026
47 of 48 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants