Deploy Grep Knowledge Agent
Self-hosted AI knowledge agent — grep, not vector embeddings
Just deployed
/var/lib/postgresql/data
Just deployed
Just deployed
/snapshot
Redis
Just deployed
/data
Deploy and Host a Grep-Based Knowledge Agent with Railway
A self-hosted AI knowledge agent that replaces vector embeddings with grep, find, and cat. Give the LLM a filesystem and bash — it searches your docs deterministically, explains every step, and costs ~75% less than vector RAG. No vector database, no Vercel lock-in.
┌─────────────┐ ┌──────────────────────────────────────────┐ ┌──────────────┐
│ Chat UI │──▶│ Web (Nuxt 4 + Nitro) │──▶│ Sandbox │
│ /settings │ │ · AI SDK agent loop + complexity router │ │ (gVisor) │
│ /login │ │ · Postgres (chats, sources, users) │ │ grep/cat/ │
│ │ │ · Redis (sessions, rate limits) │ │ find (RO) │
└─────────────┘ │ · GitHub sync → snapshot volume │ └──────────────┘
└──────────────────────────────────────────┘
About Hosting a Grep Knowledge Agent
The agent clones your GitHub repos into a snapshot volume, then uses a sandboxed shell to run read-only grep/find/cat commands against them. A complexity router classifies each question and routes to the right model — gemini-2.0-flash for trivial questions, claude-sonnet-4 for moderate, claude-opus-4 for complex. Every answer cites the files it read. Deploying on Railway gives you Postgres, Redis, persistent volumes, and private networking — all provisioned automatically with one click.
Common Use Cases
- Documentation Q&A — point it at your repo's
docs/folder and ask questions about your product - Codebase exploration — let an LLM grep through your source code to answer architecture questions
- Internal knowledge base — sync multiple repos and search across all of them with one query
- Self-hosted alternative to Vercel's knowledge-agent-template — no vendor lock-in, bring your own AI keys
- Cost-effective RAG replacement — no embedding model, no vector DB, no chunking pipeline to maintain
Dependencies for Grep Knowledge Agent Hosting
Deployment Dependencies
- Railway — hosts the web app, sandbox service, Postgres, and Redis
- OpenAI / Anthropic / Google Gemini — at least one AI provider key (bring your own)
- GitHub OAuth App — for user authentication
Implementation Details
| Vercel primitive | Railway replacement |
|---|---|
| Vercel Sandbox | gVisor sandbox (sidecar service with read-only grep/cat/find) |
| Vercel Blob | Railway Volume (snapshot directory) |
| NuxtHub KV | Redis (sessions, rate limits) |
| Vercel AI Gateway | Bring-your-own-key — OpenAI, Anthropic, or Google Gemini |
| Vercel Cron | Railway Cron (snapshot refresh) |
| Vercel Workflow | Node + Redis job runner |
Why Deploy on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it. By deploying this knowledge agent on Railway, you get Postgres, Redis, persistent volumes, and private networking — all provisioned automatically with one click.
After Deploy (3 steps)
-
Set an AI provider key — at least one of:
OPENAI_API_KEY→ platform.openai.com/api-keysANTHROPIC_API_KEY→ console.anthropic.com/settings/keysGOOGLE_GENERATIVE_AI_API_KEY→ aistudio.google.com/apikey
-
Create a GitHub OAuth app (Settings → Developer settings → OAuth Apps) with callback URL
https://.up.railway.app/api/auth/callback/github— setGITHUB_CLIENT_ID/GITHUB_CLIENT_SECRET -
Open your app → sign in → Settings → Add GitHub source → enter
owner/repo→ Sync -
Ask it anything about your repo. It answers with
grep, not vectors.
Template Content
PGDATA
PGPORT
POSTGRES_DB
POSTGRES_USER
SSL_CERT_DAYS
RAILWAY_DEPLOYMENT_DRAINING_SECONDS
NODE_ENV
SANDBOX_URL
BETTER_AUTH_SECRET
RAILWAY_DOCKERFILE_PATH
PORT
SNAPSHOT_DIR
RAILWAY_DOCKERFILE_PATH
Redis
redis:8.2.1REDISPORT
REDISUSER
