{
  "slug": "wrangler-types-generates-ai-search-binding-types-05a9b9a8a4c3",
  "title": "wrangler types generates AI Search binding types",
  "tools": [
    "wrangler"
  ],
  "tags": [
    "agent"
  ],
  "introduced_at": "2026-04-02T12:17:02.000Z",
  "announced_at": "2026-04-02T12:17:02.000Z",
  "effective_at": null,
  "date_basis": "source-publication",
  "status": "unknown",
  "how": {
    "incantation": "When a Worker repository needs environment types for AI Search bindings, add `ai_search_namespaces` and/or `ai_search` to its Wrangler config, then run `wrangler types` to generate binding types. By default, Wrangler includes bindings from all configured environments.",
    "examples": [
      "wrangler types",
      "{\"ai_search_namespaces\":[{\"binding\":\"<ENV_BINDING>\",\"namespace\":\"<NAMESPACE>\"}],\"ai_search\":[{\"binding\":\"<ENV_BINDING>\",\"instance_name\":\"<INSTANCE_NAME>\"}]}"
    ],
    "gotchas": [
      "Version: 4.80.0",
      "PATH: Optional output path for generated types; defaults to `./worker-configuration.d.ts` and must end in `.d.ts`.",
      "--env: Restricts generated bindings to the named environment; without it, bindings from all configured environments are included.",
      "ai_search_namespaces[].binding (required): Environment variable name for the namespace binding.",
      "ai_search_namespaces[].namespace (required): Namespace to bind; Wrangler creates it on deploy if it does not exist.",
      "ai_search_namespaces[].remote: Set to `true` for local development with `wrangler dev`.",
      "ai_search[].binding (required): Environment variable name for the instance binding.",
      "ai_search[].instance_name (required): AI Search instance name; it must exist in the default namespace at deploy time.",
      "ai_search[].remote: Set to `true` for local development with `wrangler dev`.",
      "Supports both simple and per-environment modes."
    ]
  },
  "why_it_matters": "Generate Worker environment types for `ai_search_namespaces` and `ai_search` bindings in a repository.",
  "sources": [
    "https://github.com/cloudflare/workers-sdk/releases/tag/wrangler%404.80.0",
    "https://developers.cloudflare.com/workers/wrangler/commands/workers/",
    "https://developers.cloudflare.com/ai-search/api/search/workers-binding/"
  ],
  "rank": 0.95027,
  "judge": {
    "publish": true,
    "judge_model": "codex-cli/gpt-6-luna+typesafe/jev-1.13.0",
    "prompt_version": "extract-v7+enrich-v1+judge-v2x3+jev-publish-v1"
  },
  "review_state": "approved",
  "provenance": {
    "run_id": "backfill-20261007",
    "verdict_id": "backfill-20261007:backfill-20261007-6e5b9cae32949ffa-0:gate",
    "evidence_hash": "61340fd593c1bbe957014b28a038cb5f7b969ca660dc4e91cd7857550a809918"
  },
  "review": {
    "draft_hash": "e73dd8396e270bd1ab32af0dfd59bf0f4decbcf692ea36f0fdb6e3f1083a9885",
    "reviewer": "publication-gate",
    "reviewed_at": "2026-10-07T00:00:00.000Z",
    "decision": "backfill-20261007:gate",
    "reason": "3 of 3 judge runs approved with p_yes >= 0.9 (mean 0.95 >= 0.9; 2 needed) and Jev gave 0.77 (>= 0.6 needed)."
  }
}
