Skip to main content

Layer 1: SDKs

How you write the agent: the loop, the state, the tools.

In this layer: Agents SDK, Think, Flue, AI SDK (Vercel).

Agents SDK​

What it is: The starter. A stateful agent class with SQL, scheduling, MCP and human-in-the-loop built in.

Use it when: Always, today: agents-starter is built on it, so every team starts here.

import { Agent } from 'agents';

export class FragmentWatcher extends Agent<Env> {
async onStart() {
await this.schedule('*/15 * * * *', 'check', {});
}
async check() { /* this.sql, this.env, this.setState() */ }
}

Basics: Agents overview · Agent class API

Advanced: Schedule tasks · State · Long-running agents

Think​

What it is: @cloudflare/think: an opinionated chat harness. You provide getModel(), it runs the loop, memory and tools.

Use it when: You want a chat agent with built-in workspace tools and approvals, and less wiring than the starter.

import { Think } from '@cloudflare/think';
import { createWorkersAI } from 'workers-ai-provider';

export class Helpdesk extends Think<Env> {
getModel() {
return createWorkersAI({ binding: this.env.AI })('@cf/meta/llama-3.3-70b-instruct-fp8-fast');
}
}

Basics: Think · Think: getting started

Advanced: Think tools and approvals · Think inside a Workflow

Flue​

What it is: Open-source agent framework that deploys onto Agents SDK primitives for durable execution.

Use it when: Your team already likes Flue’s model. Optional today: the starter is faster to a demo.

Basics: Agent harnesses

Advanced: Durable execution

AI SDK (Vercel)​

What it is: The model-agnostic streamText/tool() layer the starter already uses under the hood.

Use it when: Adding a tool, switching model, or gating a tool with needsApproval.

import { streamText, tool } from 'ai';
import { createWorkersAI } from 'workers-ai-provider';

const workersai = createWorkersAI({ binding: env.AI });
const result = streamText({
model: workersai('@cf/meta/llama-3.3-70b-instruct-fp8-fast'),
messages, tools: { /* tool({ inputSchema, execute, needsApproval }) */ },
});

Basics: Using AI models

Advanced: AI SDK docs