跳到正文

Cloudflare Agents Starter

活跃
cloudflare/agents-starter

Cloudflare 官方 AI 聊天智能体起步模板:基于 Workers AI,支持流式对话、需审批的工具调用、定时任务和图像识别。

在 GitHub 查看
星标
1344
Fork
287
关注
1344
未关闭 Issue
14

该介绍目前仅提供英文版本。

Overview

Agent Starter is Cloudflare’s official template for building AI chat agents with the Agents SDK. It gives you a working chat app — streaming responses, tools, scheduling, and image understanding — running on Workers AI, so you can start customizing an agent in minutes without a third-party model API key.

What’s Included

  • Streaming AI chat powered by Workers AI through AIChatAgent
  • Three tool patterns: server-side tools that run automatically, client-side tools answered by the browser, and human-in-the-loop tools that ask for approval first
  • Task scheduling: one-time, delayed, and recurring (cron) tasks
  • Vision: drag, paste, or attach images for vision-capable models
  • Reasoning display that streams model thinking and collapses when done
  • Debug mode to inspect the raw message JSON
  • Real-time WebSocket connection with automatic reconnection and persisted messages
  • UI built with Kumo, Cloudflare’s design system, with light and dark themes

Getting Started

npx create-cloudflare@latest --template cloudflare/agents-starter
cd agents-starter
npm install
npm run dev

Then open http://localhost:5173. Because Workers AI has no local simulator, local development uses a remote session — run wrangler login once or set a CLOUDFLARE_API_TOKEN. No OpenAI or Anthropic key is required.

Try prompts such as “What’s the weather in Paris?”, “Calculate 5000 * 3” (which asks for approval), or “Remind me in 5 minutes to take a break”.

Project Structure

File Role
src/server.ts The chat agent, its tools, and scheduling
src/app.tsx Chat UI built with Kumo components
src/client.tsx React entry point
src/styles.css Tailwind and Kumo styles

Making It Your Own

Rename the project in package.json and wrangler.jsonc (the Worker name becomes your workers.dev URL), add your own tools in server.ts, and deploy with Wrangler.

License

MIT License.

按共同分类和标签排序的同类开源项目。

全部 AI 项目 →