Cloudflare Workers AI: Frontier Models at the Edge and the Agents Infrastructure Play
Quick answer (AEO): Cloudflare Workers AI now runs frontier open-source models (starting with Kimi K2.5) at the edge, positioning itself as the inference layer for AI agents. The Agents SDK v0.3.0 adds AI SDK v6 support, dynamic tool approval (human-in-the-loop), enhanced React hooks, and improved streaming. During Agents Week 2026, Cloudflare disclosed internal adoption: 20 million requests through AI Gateway, 241 billion tokens processed, and 3,683 internal users. The pitch: “making Cloudflare the best place for building and deploying agents.”
The infrastructure play: inference as a utility
Cloudflare’s positioning is deliberate. They’re not building AI models. They’re building the infrastructure that AI models run on — the same way they built infrastructure for websites without building websites themselves.
Workers AI as inference layer means:
- Zero-setup gateways — no provisioning, no GPU management, no capacity planning.
- Automatic retries with fallback across model providers.
- Granular logging for every inference call — latency, tokens, cost, errors.
- Edge proximity — inference runs close to users, reducing round-trip latency.
The analogy: Cloudflare did for inference what they did for CDN. Instead of managing your own GPU fleet, you call an edge endpoint. Cloudflare handles routing, scaling, failover, and observability.
Frontier models at the edge: Kimi K2.5
The addition of Kimi K2.5 (Moonshot AI) to Workers AI is significant. Previous Workers AI models were smaller, utility-grade models. Kimi K2.5 is a frontier-class MoE model — the same model that ranks #1 on the open Intelligence Index.
This changes what you can build on Workers AI:
| Before (utility models) | After (frontier models) |
|---|---|
| Classification | Complex reasoning |
| Summarization | Multi-step agent tasks |
| Simple extraction | Code generation |
| Embedding generation | Agentic tool use |
// Workers AI — running a frontier model at the edge
export default {
async fetch(request: Request, env: Env): Promise<Response> {
const { messages } = await request.json();
// Kimi K2.5 — frontier MoE model, running at edge
const response = await env.AI.run('@moonshot/kimi-k2.5', {
messages,
max_tokens: 4096,
// Streaming for real-time agent responses
stream: true,
});
return new Response(response, {
headers: { 'Content-Type': 'text/event-stream' },
});
},
}; Why edge inference matters for agents: Agent loops involve multiple sequential inference calls. If each call has 200ms of network latency to a central region, a 10-step agent task adds 2 seconds of pure network overhead. Edge inference cuts this to ~20ms per call — a 10x improvement in agent responsiveness.
Agents SDK v0.3.0: the AI SDK v6 integration
The Agents SDK v0.3.0 brings first-class support for Vercel’s AI SDK v6, creating a unified development model:
Dynamic tool approval (human-in-the-loop)
The most important feature: agents can request human approval before executing sensitive tools.
import { Agent } from '@cloudflare/agents';
import { generateText, tool } from 'ai';
import { z } from 'zod';
const agent = new Agent({
model: '@moonshot/kimi-k2.5',
tools: {
readDatabase: tool({
description: 'Read data from the database',
parameters: z.object({ query: z.string() }),
// No approval needed — read-only
execute: async ({ query }) => db.query(query),
}),
deleteRecords: tool({
description: 'Delete records from database',
parameters: z.object({
table: z.string(),
condition: z.string(),
}),
// Requires human approval before execution
requiresApproval: true,
execute: async ({ table, condition }) => {
return db.delete(table, condition);
},
}),
},
}); Enhanced React hooks
Frontend integration for agent UIs:
import { useAgent } from '@cloudflare/agents/react';
function AgentChat() {
const { messages, sendMessage, pendingApprovals, approveAction } = useAgent({
agentId: 'my-agent',
// Real-time streaming via WebSocket
streaming: true,
});
return (
<div>
{messages.map(msg => <Message key={msg.id} {...msg} />)}
{/* Human-in-the-loop: show pending tool approvals */}
{pendingApprovals.map(approval => (
<ApprovalCard
key={approval.id}
tool={approval.toolName}
args={approval.arguments}
onApprove={() => approveAction(approval.id, true)}
onReject={() => approveAction(approval.id, false)}
/>
))}
</div>
);
} Improved streaming
SDK v0.3.0 streams tool call progress alongside text generation:
- Tool invocation events — see which tool the agent is calling in real-time.
- Partial results — stream intermediate tool outputs back to the UI.
- Cancellation — abort agent loops mid-execution from the client.
Moondream 3.1: vision at the edge
Cloudflare also added Moondream 3.1 — a 9B total parameter, 2B active MoE vision model. This is notable for edge deployment:
- 2B active parameters means it runs efficiently on edge hardware.
- Vision capability — agents can process images, screenshots, documents.
- MoE architecture — routes to specialized experts, so the 2B active subset is highly capable despite its size.
// Vision model at the edge — agents that can "see"
const analysis = await env.AI.run('@moondream/moondream-3.1', {
image: imageBytes, // Screenshot, document, photo
prompt: 'Describe what you see in this UI screenshot. Identify any usability issues.',
max_tokens: 1024,
}); For agent workflows that involve computer use, document processing, or visual QA, running a vision model at the edge eliminates the need to send images to a centralized API.
Internal adoption stats: what 241 billion tokens tells us
Cloudflare disclosed their own internal usage during Agents Week:
| Metric | Value |
|---|---|
| Requests through AI Gateway | 20 million |
| Tokens processed | 241 billion |
| Internal users | 3,683 |
| Models available | 30+ |
241 billion tokens processed internally means Cloudflare is dogfooding at scale. Their internal teams are building agents on the same infrastructure they sell externally. This is the strongest signal that the platform handles production workloads.
20 million requests across 3,683 users means roughly 5,400 requests per user — consistent with teams running agent loops, not just one-off inference calls.
The systems architecture: Cloudflare as the agents infrastructure layer
Cloudflare’s full agent stack:
┌─────────────────────────────────────────────┐
│ Agent Application (your code) │
├─────────────────────────────────────────────┤
│ Agents SDK v0.3.0 │
│ - Agent lifecycle management │
│ - Tool orchestration │
│ - Human-in-the-loop approval │
├─────────────────────────────────────────────┤
│ AI Gateway │
│ - Routing, retries, fallback │
│ - Logging, analytics, cost tracking │
│ - Rate limiting, access control │
├─────────────────────────────────────────────┤
│ Workers AI (Inference) │
│ - Frontier models (Kimi K2.5) │
│ - Vision models (Moondream 3.1) │
│ - Utility models (embedding, classify) │
├─────────────────────────────────────────────┤
│ Durable Objects (Agent State) │
│ - Conversation memory │
│ - Agent session persistence │
│ - Real-time WebSocket connections │
├─────────────────────────────────────────────┤
│ Vectorize (Knowledge) │
│ - RAG embedding storage │
│ - Semantic search for agent context │
├─────────────────────────────────────────────┤
│ R2 + D1 (Storage + Database) │
│ - Agent-generated artifacts │
│ - Structured data persistence │
└─────────────────────────────────────────────┘ The competitive advantage: all layers run on the same edge network. There’s no cross-region latency between inference, state, and storage. An agent can run inference, update state, query a vector database, and store results — all within a single edge location.
What this means for engineers building agents
1. Edge inference changes agent architecture
If your agents make 5-15 inference calls per task, edge inference saves 1-3 seconds per task in network latency alone. For user-facing agents (chatbots, copilots, assistants), this is the difference between “responsive” and “sluggish.”
2. Human-in-the-loop is now a first-class pattern
The Agents SDK v0.3.0 makes approval workflows trivial to implement. If your agent can take destructive actions (delete data, send emails, make purchases), you can gate those actions behind human approval with a few lines of code.
3. The full-stack agent platform consolidation
Instead of stitching together separate services for inference (OpenAI), state (Redis), storage (S3), and vector search (Pinecone), Cloudflare offers all of these on a single platform with a single billing relationship. For early-stage teams and prototypes, this reduces integration complexity significantly.
4. Open model access matters for cost control
Running Kimi K2.5 on Workers AI means you get frontier-class reasoning without per-token API pricing from model providers. Cloudflare’s pricing model (compute-time based) can be dramatically cheaper for high-volume agent workloads.
Related reading: Vercel AI SDK 6 and the agent abstraction, multi-agent orchestration patterns, and open-weight LLM landscape 2026.