Cloudflare deployment for the GenUI agent runtime. It exposes a health endpoint and routes each WebSocket session to a SQLite-backed Durable Object.
GET /healthGET /v1/sessions/:sessionId/websocketWebSocket upgrade- One hibernatable Durable Object per session
- GenUI command parsing and event broadcasting
- Runtime session restoration after Durable Object hibernation
- OpenAI secret/model binding to the shared agent runtime
Authentication, rate limits, reconnect tokens, and persistent event history are intentionally deferred. This Worker is experimental and must not be deployed as a production internet-facing gateway until those controls are implemented.
Requires Node.js 20 or newer.
npm install
cp .dev.vars.example .dev.vars
npm run check
npm run build
npm run smokenpm run smoke starts a local Worker, checks /health, opens a real WebSocket,
and verifies gateway and runtime error events without calling an AI provider.
For a live OpenAI turn, put OPENAI_API_KEY in .dev.vars, run npm run dev,
connect to the WebSocket route, then send session.start and message.send
commands from genui-agent-protocol.
Provider-independent agent behavior belongs in genui-agent-runtime-ts.
This repository is included in the
kiliczsh/genui workspace as a Git
submodule.
Sessions still request provider: "openai"; the deployment decides which
backend serves them. Point the worker at any /v1/chat/completions
endpoint via vars (in .dev.vars for wrangler dev, or worker secrets in
production):
GENUI_PROVIDER=ollama # or llamacpp | openai-compatible
GENUI_BASE_URL=https://models.example.com/v1
GENUI_MODEL=llama3.2
GENUI_API_KEY=ollama # compatible servers accept any keyWith wrangler dev on the same machine, GENUI_BASE_URL may also point at
a local server (Ollama's default is http://localhost:11434/v1). A deployed
worker cannot reach localhost — the endpoint must be publicly reachable or
exposed through a secure tunnel. The served model must support tool calling;
without it A2UI generation is unreliable.