Skip to content

feat(ag-ui): host runtimes on Railway via ag-ui-dev deployment#580

Open
blove wants to merge 15 commits into
mainfrom
claude/ag-ui-railway-deployment
Open

feat(ag-ui): host runtimes on Railway via ag-ui-dev deployment#580
blove wants to merge 15 commits into
mainfrom
claude/ag-ui-railway-deployment

Conversation

@blove
Copy link
Copy Markdown
Contributor

@blove blove commented Jun 5, 2026

Summary

  • New deployments/ag-ui-dev/ Railway deployment hosting every cockpit/ag-ui/*/python/ topic at /agent/<topic> from one FastAPI app.
  • Generated by scripts/generate-ag-ui-deployment-config.ts (mirrors scripts/generate-shared-deployment-config.ts); CI drift-checks deployments/ag-ui-dev/.
  • Defense in depth: Vercel edge middleware (origin allowlist + Upstash rate-limit + X-Internal-Token injection) on each ag-ui example; Railway FastAPI middleware verifies the same token; OpenAI project hard cap is the final backstop.
  • Healthcheck on /ok; production smoke tests probe it + the two examples routes.

Spec: docs/superpowers/specs/2026-06-05-ag-ui-railway-deployment-design.md
Plan: docs/superpowers/plans/2026-06-05-ag-ui-railway-deployment.md

Architecture

Browser → examples.threadplane.ai/ag-ui/<topic>/agent/...
       → Vercel edge middleware (origin allow + ratelimit + inject token)
       → Vercel rewrite to ag-ui-dev.up.railway.app/agent/<topic>/...
       → Railway FastAPI middleware (verify token)
       → add_langgraph_fastapi_endpoint mounted at /agent/<topic>
       → LangGraph compiled graph

Pre-flight required before merge

These cloud-side steps must be done by a human before the deploy workflow can succeed (none are code changes):

  1. Create Upstash Redis (free tier, us-east-1) — note URL + token
  2. Generate AG_UI_INTERNAL_TOKEN via openssl rand -hex 32
  3. Create Railway project + service ag-ui-dev, generate domain, project token → GitHub secret RAILWAY_TOKEN
  4. Set Railway env vars: OPENAI_API_KEY, AG_UI_INTERNAL_TOKEN, UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN
  5. Set the same AG_UI_INTERNAL_TOKEN + UPSTASH_* vars on both Vercel projects (cockpit-ag-ui-interrupts-angular, cockpit-ag-ui-streaming-angular)
  6. OpenAI hard cap $50/mo

Test plan

  • CI: existing checks (build, lint, generator unit tests) pass on PR.
  • Manual (pre-merge): railway up from deployments/ag-ui-dev/ succeeds; curl https://ag-ui-dev.up.railway.app/ok returns {"ok":true}; curl https://ag-ui-dev.up.railway.app/agent/interrupts without token returns 401.
  • Post-merge: Deploy AG-UI Railway workflow fires on push to main, runs drift check + railway up.
  • Post-merge: production smoke tests pass (apps/cockpit/e2e/production-smoke.spec.ts describe block "ag-ui Railway runtime").
  • Post-merge: open cockpit.threadplane.ai/ag-ui/interrupts/... Run tab, trigger an approval interrupt, confirm refund flow completes end-to-end against the Railway backend.

🤖 Generated with Claude Code

blove and others added 14 commits June 5, 2026 15:51
Spec for hosting the AG-UI FastAPI runtimes on Railway so the cockpit
"Run" tab can reach them. Mirrors the langgraph deployment pattern
(generated multi-topic app + drift-checked CI), adds defense-in-depth
(Vercel edge origin + rate limit + internal token, Railway middleware,
OpenAI spend cap) above the langgraph proxy's current posture.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…pit pattern

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
threadplane Ready Ready Preview, Comment Jun 5, 2026 11:02pm

Request Review

cpSync was copying project.json into deployments/ag-ui-dev/deps/<topic>/,
which made nx see duplicate project definitions (e.g.
cockpit-ag-ui-interrupts-python defined in both cockpit/ag-ui/.../python
and deployments/.../deps/interrupts). Broke `nx show projects --affected`
and the CI scope job downstream.

Filter project.json + tsconfig*.json out of the cpSync. Regenerate to
drop the stale copies under deps/.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant