Koskamo

Build a chat agent with approval-gated tools

A durable chat agent that streams AI responses, executes server-side tools automatically, runs client-side browser tools, and requires user confirmation for sensitive calculations.

How it works

Changes data in your accountsSoftware development

The agent creates a Cloudflare Worker project and configures Wrangler to bind Workers AI and a Durable Object for state persistence. It defines three tool types: an automatic server-side tool (e.g., weather), a client-side tool (e.g., timezone), and an approval-gated tool (e.g., math calculations) that checks if inputs exceed a threshold before executing. The agent then writes the server logic using the AI SDK to stream responses and handle tool calls, finally deploying the agent to the Cloudflare network.

Prompt

Paste this into an agent that has the servers below connected. Adjust the names and dates to your own.

Prompt for Build a chat agent with approval-gated tools
Create a Cloudflare chat agent using the AI SDK and Workers AI. Configure Wrangler to bind the AI model and a Durable Object for SQLite state. Implement three tools: 1) 'getWeather' which runs automatically on the server. 2) 'getUserTimezone' which is a client-side tool handled by the browser. 3) 'calculate' which requires user approval if the absolute value of either number exceeds 1000. Ensure the agent streams responses and prunes messages appropriately.

MCP servers it needs

Source

The vendor page this playbook is drawn from, and the passage that supports it.

Build a chat agent that streams AI responses, calls server-side tools, executes client-side tools in the browser, and asks for user approval before sensitive actions.
Chat agent · Cloudflare Agents docs

Each playbook is drawn from the vendor page it cites and reviewed by Koskamo before it is published. Koskamo does not run these servers or your agent: check what each tool will do before you let it act on your accounts.