Building AI Agents from Scratch
Capstone: Build a Real AI Agent
Assemble the loop, tools, memory, approval, traces, and evals into a deployable agent that finishes real multi-step tasks.
Ship one agent a second person can run from a README. You may reuse the project scout, a tracker API, or MCP servers you already have. The grade is the checklist, not the brand of model.
Build
- Python 3.10+ venv,
openaipinned,OPENAI_API_KEYand optionalOPENAI_BASE_URLdocumented. - Your
run()/Agent— no vendor agent class. - At least three tools for a real job (read + one network or MCP + one write behind approval).
- Short-term history in the process; at least one long-term fact file or table.
- Structured final result (submit tool or equivalent) your app can parse.
- Secrets from the environment only.
Connect and observe
- A CLI or HTTP job API that completes a multi-step task without you typing tool names.
agent.jsonl(or a table) with model calls, tool names, tokens.- Optional: one or more MCP servers loaded by config — extra credit, not required if the job is already real. See Giving Your Agent MCP Tools.
Test
- Happy path: two or more tools, then a structured result.
- Escape or unknown path: tool
ok: false, no crash. - Write / send / delete: human prompt, reject leaves no side effect.
- Eval file with at least three cases; print
pass n / n. - Token or step cap fires on a forced long run.
Deploy
- Process manager (systemd or equivalent) or a documented local-only reason.
- If HTTP: bind locally, proxy, HTTPS. No open model-provider key in git.
Done
When every box is honest, you have an agent framework you can copy: a loop, a registry, memory, gates, traces, and evals. Start the next product from Building a Useful Agent, not from an agent marketplace.
Course hub: Building AI Agents from Scratch. MCP companion: Building Your Own MCP Server for AI.