Agent Runtime
Where your agents execute
Run agent code on an isolate-based serverless runtime that starts in milliseconds and scales to zero between runs. Write familiar JavaScript and TypeScript, executed close to your users.
Worker Code Example
Requests Today
1,284,392
+12% from yesterday
Avg Latency
12ms
P95: 45ms
Error Rate
0.02%
3 errors today
Worker Code
Example API worker running at the edge
api/hello.ts
// api/hello.ts
export default {
async fetch(request, env) {
const url = new URL(request.url);
if (url.pathname === "/api/users") {
const users = await env.DB.prepare(
"SELECT id, name, email FROM users LIMIT 10"
).all();
return Response.json({ users: users.results });
}
return Response.json({
message: "Hello from the edge!",
timestamp: new Date().toISOString()
});
}
}Key Features
Global Edge Network
Your code runs in data centers worldwide, close to your users.
Cold Start Free
V8 isolates eliminate cold starts for consistently fast response times.
Scale to Zero
Pay only for what you use - no idle server costs.
Standard APIs
Use familiar Web APIs like fetch, Request, Response, and more.
Worker Example
Create API endpoints and agent tool handlers with a familiar fetch-based syntax.
src/index.ts
export default {
async fetch(request) {
const url = new URL(request.url);
if (url.pathname === "/api/hello") {
return Response.json({
message: "Hello from the edge!",
});
}
return new Response("Not Found", { status: 404 });
},
};