Open this lesson in your favourite AI. It'll walk you through the why, explain the demo, and quiz you on the try-it list.
Before scaling, you ship. The smallest stack for an agent that serves one real user: one VM (or PaaS), one Postgres for state + audit, one Redis for cache + rate limits, one LLM provider, one observability vendor. No Kubernetes, no microservices, no vector DB unless you need RAG. The Day 0 stack is the smallest thing that survives real traffic; everything in this course is what you add to it.
Concretely: 100/mo. You can serve a few thousand queries / day on this. Don't reach for more until traffic forces it.
Use these three in order. Each builds on the one before.
What's the smallest agentic stack that can serve real users? Name the 5 components.
Walk me through Fly.io / Render's deploy model. Why is it faster than self-managing a VM at this stage?
Compare 4 hosting options for an agentic API at <100 QPS (Fly, Render, Railway, raw VM). Pick one for your case.
# main.py — single-file agentic service
import os
from fastapi import FastAPI, Request
from anthropic import Anthropic
import redis, psycopg
app = FastAPI()
client = Anthropic()
r = redis.from_url(os.environ["REDIS_URL"])
db = psycopg.connect(os.environ["DATABASE_URL"])
TOOLS = [{"name": "search_docs", "description": "...", "input_schema": {...}}]
@app.post("/api/chat")
async def chat(req: Request):
body = await req.json()
user_id, message = body["user_id"], body["message"]
# rate limit
if not allow(user_id, limit=60, window=60):
return {"error": "rate_limited"}, 429
# run agent
messages = [{"role": "user", "content": message}]
for _ in range(4):
resp = client.messages.create(model="claude-sonnet-4-6", max_tokens=800, tools=TOOLS, messages=messages)
messages.append({"role": "assistant", "content": resp.content})
if resp.stop_reason == "end_turn":
answer = resp.content[0].text
break
# ... tool dispatch
...
# audit
with db.cursor() as cur:
cur.execute("INSERT INTO traces (user_id, query, answer) VALUES (%s, %s, %s)", (user_id, message, answer))
db.commit()
return {"answer": answer}
# Deployed on Fly.io with one command: fly launch
# Postgres via Supabase, Redis via Upstash, free tiers on both.
# That's the Day 0 stack. Don't add until you must.python3 main.py