Building Agents (the hard parts!) - Rita Kozlov, Cloudflare

Cloudflare's Developer Mission and AI Adoption 00:03

  • Cloudflare serves about 20% of all internet traffic, with products touching end-users even if they haven’t directly signed up
  • In addition to traditional services like CDN and DNS, Cloudflare offers developer resources such as functions, storage, compute, and AI inference
  • The mission is to make it very easy for developers to bring ideas to life, from writing code to deploying for millions of users
  • A significant paradigm shift toward AI adoption is underway, with rapid recent growth
  • AI usage stats: a year ago, 44% of developers and projected 50% of knowledge workers by 2030 were using AI; current numbers already exceed 75% for both groups
  • The transition in AI workloads has moved from mainly training to a majority now focused on inference, reflecting current industry trends

Automation and Agents: Productivity Shifts 03:46

  • The next phase after training and inference is automation via agents
  • Agents can go beyond simple AI augmentation (like generating an email) to handle complex workflows (gathering lists, drafting, approvals, monitoring replies)
  • Early business results include 20% revenue increases with sales automation agents, 90% faster support response times, and 50–75% time savings in applicable processes
  • Agents are already reshaping how people work and unlock new productivity gains

Core Components of Agents 05:19

  • An agent consists of: (1) client interface for human interaction, (2) AI reasoning for logic, (3) workflows for keeping track of actions, and (4) access to tools (APIs, web, databases)
  • Practical example: a voice agent would use WebRTC, speech-to-text, an LLM for reasoning, workflow tracking, and tool integrations; may also require a human in the loop for approvals

Building Agents with MCP and Cloudflare SDK 07:38

  • Anthropics' MCP (Multi-Client Protocol) is a new standard for exposing APIs to LLMs using natural language, introducing efficient tool-calling methods
  • MCP servers support multiple clients, resources (files, DB records), prompts (for agent customization), tool integration, and (theoretically) sampling
  • MCP implementation challenges involve transport protocols, authentication, and memory management
  • Cloudflare’s agents SDK provides out-of-the-box features to simplify MCP server deployment: MCP agent class, built-in auth, HTTP streaming, real-time websocket communication, React integration, and chat capabilities
  • Cloudflare's durable objects enable stateful, serverless functions, making state management easy without traditional database setup

Example: MCP Server Deployment and State Persistence 11:51

  • Deploying an MCP server on Cloudflare is quick: define an MCP class, connect tools, persist user preferences and state automatically
  • Example: building a personalized book recommendation agent that improves over time with persistent memory, regardless of client platform
  • Benefits include eliminating the need to manually manage databases, connections, or scaling—Cloudflare handles infrastructure and scaling

Workflow Coordination and Human-in-the-Loop 14:34

  • Agents benefit from workflow coordination, managing state across chains of tools and human intervention
  • Handling human-in-the-loop tasks means dealing with long-running asynchronous workflows (potentially minutes to months), requiring persistence and the ability to resume tasks
  • Use case: customer Knock implemented agent workflows for credit card approvals, integrating chat, deferred tool calls awaiting human approval, and stateful event routing, preventing duplicate actions through built-in state management

MCP Clients and Integration Options 19:10

  • MCP servers, once deployed, can be accessed by multiple client interfaces—developers’ tools like Cursor, Claude, and ChatGPT support remote MCP servers natively
  • Developers can also build custom apps or voice interfaces that interact with MCP servers, with Cloudflare tools translating WebRTC to websockets for seamless integration

Agent-Building Summary and Closing Advice 20:47

  • Building effective agents requires four key building blocks: client, AI model, workflow management, and tool integration
  • Cloudflare’s agents SDK offers a rapid and accessible way to build and deploy agents for a variety of workflows