AI agents are writing and deploying code faster than ever. But the harder question isn't speed — it's safety. When an AI agent can push code to production autonomously, how do you prevent it from breaking real users?
Cloudflare's answer is Flagship, a native feature flag service built on Workers, Durable Objects, and KV. It lets AI agents ship behind flags, test in production, observe results, and ramp rollouts without waiting for a human at every gate. For builders shipping AI-assisted code, this is the missing infrastructure piece.
The core problem Flagship solves
Most feature flag tools assume a long-lived process. They download flag rules into memory, evaluate locally, and assume the SDK instance persists between requests. That model breaks on Workers — every request could spin up a new isolate, and there's no persistent connection to keep flag configs warm.
Cloudflare solved this by building on primitives it already owns. When you create a flag, the control plane writes atomically to a Durable Object — a SQLite-backed, globally unique instance that serves as the source of truth. Within seconds, the flag config syncs to Workers KV, which is already distributed across Cloudflare's network. Evaluation happens locally on the edge, with no outbound request per flag check.
The result is sub-millisecond flag evaluation inside Workers, without reaching back to an external service on every user request.
How AI agents use Flagship as a safety layer
The workflow is designed for agentic deployment:
Human developers set the boundaries — rollout percentages, targeting rules, and abort conditions. The agent operates within those constraints. This decouples deployment from release and decouples human attention from every shipping step.
The targeting model
Flagship supports eleven comparison operators and logical AND/OR grouping. You can serve different flag values based on user attributes, request headers, geolocation, or arbitrary context. Flag variations can be booleans, strings, numbers, or structured JSON objects — useful for delivering entire configuration blocks as a single flag.
Percentage rollouts use consistent hashing, so the same user always gets the same flag value, even as the percentage changes.
OpenFeature compatibility
Flagship is compatible with OpenFeature, the CNCF open standard for feature flag evaluation. The @cloudflare/flagship SDK works from Workers, Node.js, Bun, Deno, and the browser — swap providers without changing evaluation code. The native Workers binding is fastest, but the OpenFeature path means you're not locked in.
import { FlagshipServerProvider } from '@cloudflare/flagship';
await OpenFeature.setProviderAndWait(
new FlagshipServerProvider({ binding: env.FLAGS })
);
What this means for builder teams
Feature flags are not new. But native flag evaluation inside Workers — with no latency penalty, no external round-trip, and agent-safe blast radius control — is a meaningful step for teams building AI-assisted products.
If you're building with AI coding tools and deploying to Cloudflare Workers, Flagship closes the loop between "agent writes code" and "agent ships safely." The flag becomes the contract between autonomous code and controlled user experience.
Cloudflare Flagship is available in closed beta.