Session 1 homework: ship your reliable reasoning endpoint
Ship the reasoning core for your capstone: a `POST /ask` endpoint that takes a question and returns an answer, tokens used, and cost per call, plus a Streamlit UI that calls it. A notebook experiment does not count. A localhost-only server does not count. Done means a public HTTPS URL someone else can hit, and a UI that demos the call.
Ready when
Basic submission first
Enough to pass: live `/ask`, structured JSON with `answer`, `tokens_used`, and `cost_usd`, proof from curl, and a Streamlit UI that calls `/ask`. Guardrail proof, README polish, model-cost writeup, and LinkedIn are add-ons.
Tip
Start from the Week 1 starter repo
Clone or fork Week 1 /ask demo code (5 stages). Work through stages 1 to 5 (or jump to `main.py` once you understand each layer). Do not rebuild from scratch unless you have a strong reason.
1. Local first
- 1
Environment
Copy `.env.example` to `.env`, add `OPENAI_API_KEY`, install deps, activate your venv.
- 2
Run stage 5
`uvicorn main:app --host 127.0.0.1 --port 8000 --reload` (or `serve_stage5.py` if you are still stepping through).
- 3
Smoke test
Run `python test_all_stages.py` and curl locally until you get structured JSON with `answer`, `tokens_used`, and `cost_usd` every time.
2. Deploy on Render
- 1
Push to GitHub
Your fork of the starter (or your capstone repo with the same `/ask` contract) on a branch Render can build from.
- 2
Create a Web Service
On Render, connect the repo. Runtime: Python. Build: `pip install -r requirements.txt`. Start: `uvicorn main:app --host 0.0.0.0 --port $PORT`.
- 3
Set secrets
Add `OPENAI_API_KEY` in Render environment variables. Redeploy if you change them.
- 4
Wait for green
First deploy can take a few minutes. Note your public URL (e.g. `https://your-service.onrender.com`).
3. Prove it from outside your machine
Run curl against your live Render URL, not localhost. Paste the command and response in the Maven submission channel.
Example
Live curl (replace the host)
curl -s -X POST https://YOUR-SERVICE.onrender.com/ask \ -H "Content-Type: application/json" \ -d '{"question": "What is RAG in one sentence?", "model": "gpt-4o-mini"}'
Critical
Not done until the public URL works
If only you can hit it on your laptop, it is not shipped. Week 2 attaches RAG to this endpoint - you need a stable public base URL.
4. Streamlit UI (required)
Run the starter Streamlit demo (or your own one-page UI) so it POSTs to `/ask` and shows `answer`, `tokens_used`, and `cost_usd`. Screenshot the UI with a real question for Maven. Curl alone is not enough.
5. Optional add-ons
- Trigger `force_bad` and screenshot the guardrail catching malformed output.
- Write 1-2 sentences on model choice and approximate cost per call.
- Polish the README with setup/run/deploy instructions.
- Publish a LinkedIn proof post with screenshots only, never the live URL.
6. Get cohort feedback
Submit in Maven Student Home → General submissions. Share your live URL, the curl command, a Streamlit screenshot, and one specific ask. Reading how others structured their endpoint is the fastest way to sharpen your own.
7. Optional: post on LinkedIn
Critical
Do NOT share your live URL publicly
Never paste your Render (or other) service URL on LinkedIn or anywhere public. Anyone with the link can hit your `/ask` endpoint and burn your OpenAI credits. Submit the live URL only in the Maven submission channel. On LinkedIn, use screenshots or a short screen recording only.
If you choose the LinkedIn add-on, tell the story of going from model call to reliable component. Use 2 to 4 screenshots or a 30 to 60 second screen recording showing your curl request, the structured JSON response, and optionally your Render deploy or guardrail catching bad output. No live URL in the post.
Your task
Copy, adapt, and post on LinkedIn
Week 1 of the Agentic AI Engineering Bootcamp with The AI Internship - I just shipped my first production LLM endpoint. What I built: POST /ask for [your capstone domain]. Question in, schema-validated answer out - with tokens_used and cost_usd on every call. What I learned: • A model call in a notebook is not a reliable component • Structured outputs turn free text into something downstream code can depend on • Guardrails catch malformed output before it reaches users • Model choice is an engineering tradeoff (quality vs cost vs latency) How I built it: forked the Week 1 starter repo, worked through stages 1-5 with [Cursor / Claude Code], deployed to Render, proved it with curl against my live URL. Outcome: [one sentence on your capstone reasoning core] - ~$[cost_usd] per call on [model name]. [Attach 2-4 screenshots or a 30-60s screen recording: terminal curl, JSON response with answer + tokens + cost, optional Render dashboard or guardrail demo. Do NOT paste your live service URL.] Cohort: feedback welcome in Maven. #AgenticAI #AIEngineering #LLM #FastAPI #TheAIInternship
Done when
- Built from the Week 1 starter repo (stages 1-5 or `main.py`) and runs locally
- `python test_all_stages.py` passes (or equivalent smoke test you document)
- Deployed to Render (or equivalent) with a public HTTPS URL
- curl against the live URL returns schema-valid structured output
- Response includes `tokens_used` and `cost_usd` (or equivalent per-call cost)
- Streamlit UI calls `/ask` and shows answer + tokens + cost (screenshot for Maven)
- Live URL submitted only in Maven, not publicly
Submit in Maven: Maven submission only: live URL, curl command, and one ask. LinkedIn add-on: screenshots only. Never post the live URL publicly.