Chat SDK now ships a built-in AI SDK toolset through the new chat/ai subpath. One createChatTools(chat) call wires Chat SDK's read and write actions into your agent.

import { Chat } from "chat";

import { createChatTools } from "chat/ai";

import { ToolLoopAgent } from "ai";

const chat = new Chat({ userName: "mybot" /* ... */ });

const agent = new ToolLoopAgent({

model: "openai/gpt-5.4",

instructions: 'You are a helpful assistant.'

tools: createChatTools(chat, { preset: "messenger" }),

});

Create a chat agent with the messenger preset

  • Approval by default: write tools are gated by a requireApproval option.

  • Presets: reader, messenger, and moderator scope the toolset.

  • Lazy loading: only the tools your preset allows are constructed.

toAiMessages and its supporting types have moved to chat/ai. The previous chat re-exports are flagged @deprecated.

Read the documentation to get started, or try one of our templates.

The Complete Guide to Chat SDK

Learn how Chat SDK works end-to-end: from core concepts to building your first bot to deploying it across platforms.

Read the guide