Skip to main content
Every agent uses operations to do work. Each operation does one thing well.

Core Operations

think

AI reasoning (GPT, Claude, Llama, ML models)

code

JavaScript/TypeScript execution

storage

KV, D1, R2, Vectorize access

http

HTTP requests to APIs

tools

MCP tools and skills

email

Send emails

sms

Send SMS messages

html

Render HTML

pdf

Generate PDFs

html

Full-stack pages

form

Generate validated forms

queue

Message queue processing

telemetry

Analytics Engine metrics
Documentation: The docs/ directory is a first-class component for API documentation. See Building Documentation.

Operation Basics

Declaration

Operations are declared in agents:

Execution

Operations run when the agent executes:

Chaining

Operations reference each other’s outputs:

Operation Categories

1. Compute Operations

Execute logic and transform data. think - AI reasoning:
code - JavaScript/TypeScript:

2. Data Operations

Access and manipulate data stores. storage - All Cloudflare storage:

3. Communication Operations

Send messages and notifications. http - HTTP requests:
email - Send emails:
sms - Send SMS:

4. Presentation Operations

Render content for users. html - HTML rendering:
pdf - PDF generation:
form - Form generation:

5. Async Operations

Process background jobs and messages. queue - Message queue processing:

6. Extension Operations

Extend functionality with external tools. tools - MCP tools and skills:

Operation Features

Conditional Execution

Skip operations based on conditions:

Caching

Cache operation results:

Retry Logic

Automatic retries on failure:

Parallel Execution

Operations without dependencies run in parallel:

Operation Reference

Common Configuration

All operations support:

Output Access

Access operation outputs using template syntax:

Best Practices

  1. Use the Right Operation - Each operation is optimized for its use case
  2. Cache Expensive Operations - Especially AI and HTTP calls
  3. Handle Failures - Use conditions and retry logic
  4. Optimize for Parallel - Don’t create unnecessary dependencies
  5. Keep Operations Simple - Single responsibility per operation
  6. Use Built-in Features - Leverage caching, retry, and conditions
  7. Monitor Performance - Track operation execution times
  8. Test Thoroughly - Unit test each operation

Performance Tips

1. Parallel Execution

2. Conditional Execution

3. Operation Caching

Next Steps

Agents

Learn about agents

Operations Reference

Detailed operation docs

Flow Control

Control execution flow

Building Agents

Create custom agents