common-agents

Introduction

common-agents is a production-ready multi-agent framework built on top of the Cloudflare Agents SDK. Available on npm as common-agents.

This directory contains detailed documentation for each agent type in the Common Agents Framework.

Why Delegate to Different Agent Types?

Think about how a company operates. You don’t hire one person to do everything - writing code, managing finances, handling customer support, and making strategic decisions. Instead, you have specialized teams:

Each team has clear responsibilities, specialized expertise, and well-defined interfaces for communicating with other teams. An engineer doesn’t need to know accounting principles. A finance manager doesn’t need to understand database optimization. This separation allows each team to focus on what they do best, while the company as a whole accomplishes complex objectives.

The same principle applies here: Different responsibilities require different lifecycles and capabilities.

By delegating to specialized agent types, you get:

Further Learning: For a deeper exploration of why putting components in well-defined “boxes” leads to more reliable systems, watch Kenton Varda’s talk: Let’s put the AI in lots of little boxes (Cloudflare Connect 2025).

Configuration & Setup

Registering Agents in wrangler.toml

Before you can use agents in your application, they must be registered in your wrangler.toml configuration file. Each agent needs a binding (the environment variable name) and a class_name (the TypeScript class).

[[agents]]
binding = "MY_AGENT"
class_name = "MyAgentClass"

[[agents]]
binding = "DATA_WORKER"
class_name = "DataWorker"

[[agents]]
binding = "COORDINATOR"
class_name = "DataCoordinator"

How it works:

  1. The binding defines the environment variable name that will be available in your code
  2. The class_name must match the exported class name in your TypeScript code
  3. Cloudflare automatically creates an AgentNamespace for each binding
  4. You access agents via env.MY_AGENT, env.DATA_WORKER, etc.

Example:

// In your TypeScript code
interface Env {
  MY_AGENT: AgentNamespace<MyAgentClass>;
  DATA_WORKER: AgentNamespace<DataWorker>;
  COORDINATOR: AgentNamespace<DataCoordinator>;
}

// Access agents using getAgentByName
const agent = await getAgentByName(env.MY_AGENT, 'instance-id');
const result = await agent.someMethod();

For more details on Cloudflare Agents configuration, see the Cloudflare Agents documentation.

Agent Types

The framework provides two fundamental categories of agents:

Permanent Agents (Long-Lived)

Permanent agents maintain durable state and live indefinitely. They’re ideal for:

Available Permanent Agents:

Ephemeral Agents (Self-Destructing)

Ephemeral agents are created for specific tasks and self-destruct after completion. They’re ideal for:

Available Ephemeral Agents:

Quick Navigation

Core Agents (Start Here)

Routing & Scheduling

Data & State Management

Advanced Processing

Additional Resources