**Lecture 36: Personal Agent — OpenClaw + Course Wrap-Up** **Total Time: 50 minutes** **Spectrum: Code Agent applied to personal productivity** **Code: OpenClaw (github.com/openclaw/openclaw)** **Punchline: Same architecture, different tools. The agent pattern is domain-independent.** **[3 min] 0. Housekeeping** - Recap Lec 35: production architecture (184 tools, routing, context management) - Today: apply the pattern to a new domain + wrap up Theme 4 **[12 min] 1. WHAT: OpenClaw — Same Pattern, New Domain** - "The AI that actually does things" — personal agent via WhatsApp/Telegram - Side-by-side comparison: | | Claude Code | OpenClaw | |---|------------|----------| | Domain | Code | Life | | Tools | Read, Write, Bash, Grep | SendEmail, Calendar, BookFlight | | Context | Git branch, CLAUDE.md | Contacts, preferences, history | | Loop | Same while-loop | Same while-loop | | Permissions | "Write this file?" | "Send this email?" | - **Punchline**: change the tools, keep the architecture. Agent pattern is domain-independent. **[10 min] 2. WHY: 3 Levels of Agent Safety** - **#1 Permissions** (what we built in L33): gate individual tool calls. Read=safe, Bash=ask. - **#2 Sandboxing**: run agent in isolated environment. Docker containers, VM, restricted filesystem. Limits blast radius. - **#3 Evaluation**: how do you know the agent works? Benchmarks (SWE-bench for coding), sandboxed tests, human review loops. - **Stakes scale with domain**: wrong code commit < wrong email sent < wrong medical diagnosis. Safety investment must match stakes. **[10 min] 3. HOW: Building Domain-Specific Agents (3 steps)** - **(a) Pick your tools**: what actions does your domain need? (PubMed search, DICOM viewer, email sender...) - **(b) Write your context**: domain-specific system prompt + CLAUDE.md equivalent. Medical agent needs different instructions than coding agent. - **(c) Set your permissions**: which tools are safe? Which need human approval? Domain determines the answer. - **That's it.** The loop (agent.py), the dispatcher (tools.py), the REPL (nano_claude.py) stay the same. **[12 min] 4. The Full Spectrum: L32–L36 Recap** - **L32**: FM (API) — call an LLM, get text back. config.py. - **L33**: Multi-step Agent — tools + loop + feedback. 4 files, working agent. - **L34**: Multi-Agent — fork, run, collect. Biomedical workflows. - **L35**: Code Agent at Scale — routing, context management, 184 tools. - **L36**: Personal Agent — same architecture, different tools. - **The punchline of Theme 4**: An agent is just a while loop + tool dispatch + permission gate. ~1,200 lines. Everything else is scaling. **[3 min] 5. Wrap-Up & Looking Ahead** - **Theme 4 complete**: you can build, scale, and deploy agents - **PS4 due**: agentic systems assignment - **Final project slides due**: apply agent concepts to your research domain - **Next**: Final project presentations (Lec 37–39)