Skip to content

CLI

Last updated View as MarkdownAgent setup

This guide walks you through creating an AI Search instance using the Wrangler CLI.

1. Install Wrangler

Install Wrangler, the command-line tool for Cloudflare Workers and developer platform products.

npm install wrangler

2. Create an AI Search instance

Create a new instance.

wrangler ai-search create my-instance

You can upload files to the instance using the dashboard or the REST API.

Connect a data source (optional)

You can optionally connect a website or R2 bucket when creating the instance.

Website:

Automatically crawl and index a website that you own.

wrangler ai-search create my-instance --type web-crawler --source developers.cloudflare.com

R2 bucket:

Index documents stored in an R2 bucket.

wrangler ai-search create my-instance --type r2 --source my-bucket

3. Check indexing status

Check if your content has finished indexing by running the stats command.

wrangler ai-search stats my-instance

4. Test your instance

Once indexing is complete, run a search query against your instance.

wrangler ai-search search my-instance --query "What is Cloudflare?"

For the full list of available commands, refer to Wrangler commands.

Add to your application

REST API

Query AI Search using HTTP requests.

Was this helpful?