

import { Agent, type Connection, type WSMessage } from "agents"; export class Chef extends Agent<Env, { notes: string[] }> { initialState = { notes: [] }; async onMessage(conn: Connection, msg: WSMessage) { const notes = [...this.state.notes, String(msg)]; this.setState({ notes }); // 기억합니다 · Stateful const { response } = await this.env.AI.run( // 생각합니다 · AI-Native "@cf/meta/llama-3.1-8b-instruct", { prompt: notes.join("\n") }); conn.send(response); } } // 기다릴 땐 잠듭니다 · Lightweight
cf deploy→ 335+ 도시, 한 번에.335+ cities, in one deploy.