Cloudflare Agents SDK: tool use and memory at the edge
Posted by Vishnu Narayan · 2026-03-02
Cloudflare ships the Agents SDK — tool use, memory, multi-step reasoning running on Workers. Build AI agents that deploy globally in seconds. https://github.com/cloudflare/workers-sdk
// Cloudflare Agents SDK
import { Agent, Tool } from '@cloudflare/agents';
const searchTool = new Tool({
name: 'search',
description: 'Search the knowledge base',
parameters: { query: { type: 'string' } },
execute: async ({ query }, env) => {
const results = await env.VECTORIZE.query(query, { topK: 5 });
return results.matches.map(m => m.metadata.text);
}
});
export default new Agent({
model: '@cf/meta/llama-3.1-70b',
tools: [searchTool],
memory: { type: 'durable-object' },
});