OpenAI shuts down Agent Builder on Nov 30, 2026 (deprecations page). Its Code button exports a workflow as Agents SDK code. This example runs a workflow in that shape on a Cloudflare Worker, with the OpenAI Agents SDK for JavaScript and a small chat page in place of the hosted ChatKit embed.
src/workflow.js is our own sample workflow with the node shape of an Agent Builder TypeScript export: a guardrail node, one agent with a function tool, and an end node. A buyer's export replaces the guardrail, the agent and its tool; the rest of the Worker stays. We tested first against the export in this tutorial.
src/workflow.js:runWorkflowand its three nodes. All the Agents SDK code is here.src/index.js: the Worker.POST /chattakes{ messages: [{ role, content }] }, checks it, and runs the workflow.?stream=1streams the answer as text.public/index.html: the chat page (static assets). It keeps the history in the browser tab.notes.json: what thesearch_notestool searches.worker.test.js: the input checks, the guardrail node, and one full turn with a tool call, against a fake model (no network).check.mjs: three real turns against a running Worker, the last one blocked by the guardrail.output.txtis its real output.
npm install
node --test --test-concurrency=1 worker.test.js
OPENAI_API_KEY=sk-... npx wrangler dev # http://localhost:8787
node check.mjs http://localhost:8787
npx wrangler login && npx wrangler secret put OPENAI_API_KEY && npx wrangler deployAnother OpenAI-compatible provider: set OPENAI_BASE_URL and MODEL (our test used Groq, https://api.groq.com/openai/v1 and openai/gpt-oss-20b). Hosted tools then do not work, because they need OpenAI's Responses API.
- The guardrail node is a plain word check on the user's messages, so a reworded attempt gets past it. A real export's guardrail node ports to
@openai/guardrails0.3.0, which runs on Workers (we tested its Jailbreak check there) and adds about 6.6 MB to the bundle. - After a message trips the guardrail, the rest of that chat is refused too, because the page sends the whole history. Reload the page to start over.
- No ChatKit: its custom backend must speak the ChatKit server protocol, and OpenAI ships that only as a Python SDK.
- No saved threads. Traces are off.