Skip to main content
This guide covers everything you need to run Conductor on Cloudflare’s edge platform.

Workers AI

AI models running at the edge. No API keys, no external dependencies.

Setup

Add to wrangler.toml:
That’s it. No additional configuration.

Available Models

Text Generation:
  • @cf/meta/llama-3.1-8b-instruct - Fast, good quality (recommended)
  • @cf/meta/llama-3-8b-instruct - Previous generation
  • @cf/mistral/mistral-7b-instruct-v0.1 - Fast, creative
Embeddings:
  • @cf/baai/bge-base-en-v1.5 - 768 dimensions (recommended)
  • @cf/baai/bge-small-en-v1.5 - 384 dimensions (faster)
  • @cf/baai/bge-large-en-v1.5 - 1024 dimensions (best quality)
Image:
  • @cf/stabilityai/stable-diffusion-xl-base-1.0
Full list: https://developers.cloudflare.com/workers-ai/models/

Usage in Ensembles

Limits

  • Free: 10,000 neurons/day (~100 requests for Llama 3.1)
  • Paid: Unlimited, pay per neuron

KV (Key-Value Storage)

Fast, globally replicated key-value store. Perfect for caching.

Create Namespace

Output:

Configure

Add to wrangler.toml:

Usage in Ensembles

KV Operations

Get:
Put:
Delete:
List:

Limits

  • Free: 100,000 reads/day, 1,000 writes/day
  • Paid: Unlimited, 0.50/millionreads,0.50/million reads, 5/million writes
  • Key size: Max 512 bytes
  • Value size: Max 25MB
  • Latency: <10ms globally

D1 (SQL Database)

SQLite at the edge. Perfect for structured data.

Create Database

Output:

Configure

Add to wrangler.toml:

Create Schema

Edit migrations/0001_initial_schema.sql:
Apply migration:

Usage in Ensembles

Query (SELECT):
Insert:
Update:
Batch Insert:

D1 CLI Commands

Limits

  • Free: 5M rows read/day, 100k rows written/day
  • Paid: Unlimited, 0.001/1krowsread,0.001/1k rows read, 1/1M rows written
  • Database size: 10GB (can request increase)
  • Query time: 30 seconds max

R2 (Object Storage)

S3-compatible object storage. No egress fees.

Create Bucket

Configure

Add to wrangler.toml:

Usage in Ensembles

Upload:
Download:
Delete:
List:

R2 CLI Commands

Limits

  • Storage: 10GB free, then $0.015/GB/month
  • Class A operations (writes): 1M free/month, then $4.50/million
  • Class B operations (reads): 10M free/month, then $0.36/million
  • Egress: FREE (no egress fees!)
  • Max object size: 5TB

Vectorize (Vector Database)

Vector similarity search. Perfect for RAG and semantic search.

Create Index

Dimension options:
  • 384: @cf/baai/bge-small-en-v1.5
  • 768: @cf/baai/bge-base-en-v1.5 (recommended)
  • 1024: @cf/baai/bge-large-en-v1.5
  • 1536: OpenAI text-embedding-3-small
Metric options:
  • cosine: Best for normalized vectors (recommended)
  • euclidean: L2 distance
  • dot-product: Inner product

Configure

Add to wrangler.toml:

Usage in Ensembles

Insert Vectors:
Search Vectors:
Delete Vectors:

Vectorize CLI Commands

Limits

  • Free: Included in Workers plan
  • Max vectors: 5M (can request increase)
  • Max dimensions: 1536
  • Query latency: ~50ms

Durable Objects

Stateful edge workers. Perfect for real-time features.

Configure

Add to wrangler.toml:

Export Classes

In src/index.ts:

Usage

Conductor uses Durable Objects internally for:
  • HITL (Human-in-the-Loop): Approval workflows
  • Long-running executions: State persistence
You typically don’t interact with them directly.

Queues

Asynchronous task processing.

Create Queue

Configure

Add to wrangler.toml:

Usage in Ensembles

Send Message:
Consumer (in src/index.ts):

Complete Configuration Example

Here’s a full wrangler.toml with all services:

Best Practices

  1. Use KV for caching - Fast and cheap
  2. Use D1 for structured data - When you need SQL
  3. Use R2 for large files - No egress fees
  4. Use Vectorize for semantic search - Native vector support
  5. Use Queues for async work - Don’t block requests
  6. Separate environments - dev, staging, production
  7. Monitor limits - Check Cloudflare dashboard regularly
  8. Optimize queries - Add indexes to D1 tables

Cost Optimization

Stay in Free Tier

  • Workers: 100k requests/day
  • KV: 100k reads, 1k writes/day
  • D1: 5M reads, 100k writes/day
  • R2: 10GB storage, 1M writes, 10M reads/month
  • Workers AI: 10k neurons/day

Tips to Reduce Costs

  1. Cache aggressively - Use KV to cache AI/API results
  2. Use Cloudflare AI - Cheaper than external providers
  3. Batch D1 operations - Reduce write counts
  4. Use R2 for storage - No egress fees
  5. Monitor usage - Set up billing alerts

Next Steps

Operations Reference

Learn all 12 operations

Core Concepts

Deep dive into concepts

Starter Kit

Use ready-made agents

Playbooks

Real-world examples