Skip to content

About

Cloudflare deployment for GenUI sessions, WebSockets, storage, authentication, and rate limits.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

GenUI Cloudflare Agent

Cloudflare deployment for the GenUI agent runtime. It exposes a health endpoint and routes each WebSocket session to a SQLite-backed Durable Object.

Implemented

  • GET /health
  • GET /v1/sessions/:sessionId/websocket WebSocket 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.

Local verification

Requires Node.js 20 or newer.

npm install
cp .dev.vars.example .dev.vars
npm run check
npm run build
npm run smoke

npm 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.

OpenAI-compatible backends (Ollama, llama.cpp)

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 key

With 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.

About

Cloudflare deployment for GenUI sessions, WebSockets, storage, authentication, and rate limits.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages