cloudflare

Introducing Flagship: feature flags built for the age of AI (opens in new tab)

AI-generated code is moving toward autonomous production deployment, making safety and controlled rollout essential. The post argues that feature flags provide the guardrails: agents can deploy disabled code, test it with limited cohorts, monitor results, and roll back automatically. Cloudflare’s new Flagship service is designed for this workflow, evaluating flags at the edge through Workers, KV, and Durable Objects.

Feature Flags for Autonomous Deployment

  • Agents can ship code behind an off flag without affecting users.
  • They can enable features for themselves or small test cohorts, observe metrics, and expand or disable rollouts.
  • Humans define boundaries while flags limit the blast radius.
  • This separates not only deployment from release, but also routine shipping decisions from constant human attention.

Problems with Feature Flags on Workers

  • Hardcoded flags are initially convenient because Workers deploy quickly.
  • Over time, flags become fragmented across teams, with no central visibility or audit trail.
  • Troubleshooting may require searching version history with tools such as git blame.
  • Calling an external flag service adds a network request to every user request, potentially introducing significant latency.
  • This undermines the advantage of running applications close to users at the edge.

Why Local Evaluation Is Difficult on Workers

  • Traditional local-evaluation SDKs download rules into a long-lived process.
  • Worker isolates may be created and evicted between requests, requiring repeated initialization.
  • Serverless environments therefore need a distribution system with edge-local reads and managed synchronization.
  • Flagship uses Cloudflare KV to provide this distribution without persistent connections or per-request external calls.

How Flagship Works

  • Flagship is built on Workers, Durable Objects, and KV, without external databases or centralized evaluation servers.
  • Durable Objects provide a globally unique, SQLite-backed source of truth for flag configuration and changelogs.
  • Changes are synchronized to KV within seconds and replicated throughout Cloudflare’s network.
  • Evaluations read configuration from KV at the edge and execute targeting and rollout logic inside the Worker isolate.
  • Both flag data and evaluation logic remain close to the request.

Worker Binding and Typed Evaluation

  • Workers connect Flagship through a wrangler.jsonc binding containing a binding name and app_id.
  • The binding supports typed methods including:
    • getBooleanValue()
    • getStringValue()
    • getNumberValue()
    • getObjectValue()
  • *Details() methods return the value, matched variant, and selection reason.
  • Evaluation errors return the supplied default value.
  • Type mismatches throw exceptions because they indicate application bugs rather than temporary service failures.

OpenFeature Integration

  • Flagship is built on OpenFeature, the CNCF standard for feature-flag evaluation.
  • It supports Workers as well as Node.js, Bun, Deno, and browser environments.
  • The service is currently available in closed beta.

Flagship is positioned as an edge-native feature-flag system for safely automating deployment and rollout. For Cloudflare Workers, its direct binding avoids network round-trips while providing centralized configuration, targeting, auditability, and controlled release mechanisms.