Agent Infrastructure Comparison

Archived

One ReAct agent, four ways to serve an LLM — home GPU, rented cloud GPU, API, or entirely in your browser. Archived; the in-browser agent still runs.

Loading interactive demo…

What This Was

The same LangGraph ReAct agent deployed four ways at once — a home RTX 4080, a rented Vast.ai GPU, OpenRouter's API, and the visitor's own browser — answering each query side-by-side while streaming live latency and cost metrics. The three server deployments are torn down now; the in-browser agent above still runs, free, entirely on your device.

Infrastructure comparison — LangGraph ReAct agent across 4 deployment types

Shared Design Decisions

Model — Qwen3 8B

One model across all three server deployments for an apples-to-apples comparison — runs on consumer GPUs, ships as a Q4_K_M GGUF for Ollama (~5.2 GB VRAM), and is available through OpenRouter.

Search — Tavily

Purpose-built for agents: clean LLM-ready text, 1,000 free requests a month. DuckDuckGo rate-limits scrapers, Brave returns raw JSON, Jina went auth-only.

Capped at 2 searches per query to stop runaway ReAct loops.

Ollama, not vLLM

The demo capped at 3 concurrent users — Ollama handles that and runs natively on Windows. Production would swap in vLLM for continuous batching; both speak the OpenAI API, so only MODEL_BASE_URL changes.

Rate Limiting — Upstash Redis

50 requests per IP per day in front of all four proxies — protects the Tavily quota and GPU compute no matter which backend serves the query.

Cost Comparison

Deployment
Per Query
Monthly
SELF_HOSTED
$0.00
~$4 electricity
Hardware is sunk cost. RTX 4080 draws ~150 W under inference load.
VAST_AI_GPU
$0.00
~$34
$0.15/hr × ~227 hrs/month (scheduled on/off only).
OPENROUTER_API
~$0.0005
< $1 at demo traffic
Scales linearly with query volume. No fixed infrastructure cost.
CLIENT_BROWSER
$0.00
$0.00
Computation runs entirely in the visitor's browser.
Vast.ai runs on a fixed schedule (06:30–17:00 IL, Sun–Thu) — roughly 227 billable hours/month at $0.15/hr.

The Four Deployments

01 — SELF_HOSTED
Local desktop via Cloudflare Tunnel

Ollama on the home RTX 4080, exposed over HTTPS by a free Cloudflare Tunnel — no port-forwarding, one command to start, $0 per query on hardware that was already there.

GPURTX 4080 · 16 GB VRAM
InferenceOllama · qwen3:8b · Q4_K_M
TunnelCloudflare (free)
Concurrency3 parallel slots
Cost$0 / query
02 — VAST_AI_GPU
Rented cloud GPU

GitHub Actions booted the instance at 06:30 and shut it down at 17:00, Sunday–Thursday: near-zero idle cost without serverless cold starts, since no visitor waits 2–3 minutes for a model to load. A startup script rebuilt the whole stack on every boot — restart = redeploy.

GPURTX 3090 · 24 GB VRAM
InferenceOllama · qwen3:8b
Schedule06:30–17:00 IL · Sun–Thu
BillingPer-hour while running
Cost~$0.15/hr · $0 / query
03 — OPENROUTER_API
Railway + OpenRouter

No GPU at all — Railway's free tier proxies to OpenRouter and auto-deploys on push. Cost scales per query instead of per hour, and at real scale managed inference can beat paying the engineers who'd maintain self-hosted serving.

GPUNone (API call)
Modelqwen/qwen3-8b via OpenRouter
HostingRailway · free tier · Docker
DeployAuto on git push
Cost~$0.0005 / query
04 — CLIENT_BROWSER
In-browser inference · Transformers.js + ONNX

The whole ReAct loop runs in a Web Worker on Transformers.js + ONNX: the model emits a web_search action, the worker calls the Nitro → Tavily proxy, feeds the result back as an observation, and loops to a final answer. Desktop tries WebGPU with Qwen2.5-0.5B; mobile and low-RAM devices fall back to WASM with SmolLM2-135M. Nothing but the search query leaves the device.

Desktop modelQwen2.5-0.5B · WebGPU → WASM
Mobile modelSmolLM2-135M · WASM only
RuntimeTransformers.js + ONNX
SearchProxied · Nitro → Tavily
Cost$0 / query