Newsletter image

Subscribe to the Newsletter

Join 10k+ people to get notified about new posts, news and tips.

Do not worry we don't spam!

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Search

GDPR Compliance

We use cookies to ensure you get the best experience on our website. By continuing to use our site, you accept our use of cookies, Privacy Policy, and Terms of Service.

Cloudflare - AI Agent

Cloudflare Open Source AI Agent Framework

Cloudflare's open-source AI Agent Framework simplifies the creation of AI agents on their serverless Workers platform. Key features include the Agents-SDK for easy agent development, state persistence with Durable Objects, autonomous task execution using LLMs, real-time web browsing, broad AI model integration, and scalability across Cloudflare’s global network. Developers can build and deploy agents with minimal code, exemplified by a chat agent that streams responses and maintains chat history. Use cases include chatbots, vacation planning, and data monitoring. The framework offers accessibility, cost-effective serverless pricing, and plans for future enhancements. More information is available on GitHub or in the related blog post.
2025-03-13
Updated 2025-03-13 10:31:51

Cloudflare’s open-source AI Agent Framework simplifies building AI agents that run on their serverless Workers platform.

Key Features

  • Agents-SDK: Open-source JavaScript package on GitHub for easy agent creation.
  • State Persistence: Uses Durable Objects to keep agent state, like chat history, across sessions.
  • Task Execution: Agents adapt and run tasks autonomously with LLMs deciding actions.
  • Web Browsing: Real-time web interaction and streaming via WebSockets.
  • AI Integration: Works with any AI model (e.g., Workers AI, OpenAI) with streaming support.
  • Scalability: Runs on Cloudflare’s global network, scaling to millions of agents.

How It Works

Build and deploy agents with minimal code. Here’s a basic example of a chat agent:

<!-- server.ts -->
import { Agent } from 'agents-sdk';
import { streamText } from 'ai-sdk';
import { createWorkersAI } from 'workers-ai-provider';

export default class ChatAgent extends Agent {
  async onMessage(message) {
    const ai = createWorkersAI({ binding: this.env.AI });
    const result = await streamText({
      model: ai('@cf/llama-2-7b'),
      prompt: message.content,
      stream: true
    });
    this.send(result); // Stream to client
    this.setState({ lastMessage: message.content }); // Save state
  }
}
    

Deploy with wrangler deploy and it’s live globally.

Use Cases

Example Description
Chatbot Streams responses and remembers past messages.
Vacation Planner Books trips by browsing and calling APIs.
Data Monitor Runs scheduled queries and reports results.

Why It Matters

  • Accessibility: Easy for developers to start with low code.
  • Cost: Serverless pricing, free tiers for open-source projects.
  • Future: Plans for email, voice, and self-hosting features.

Check it out on GitHub or the blog post from February 25, 2025, “Making Cloudflare the best platform for building AI Agents.

Prev Article
Mac Automation: The Integration of macOS-use into pinokio.computer
Next Article
Gemma 3: Google Open-Source Gambit

Related to this topic: