In this 19 hour course, we will build an AI coding agent that can read your codebase, write and edit files, run commands, search the web. It remembers important context about you across sessions, plans, executes and even spawns sub-agents when tasks get complex. When context gets too long, it compacts and prunes so it can keep running until the task is done. It catches itself when it's looping. Also learns from its mistakes through a feedback loop. And users can extend this system by adding their own tools, connecting third-party services through MCP, control how much autonomy it gets, save sessions and restore checkpoints.
📌 Discord Server - / discord
Github Repository - https://github.com/RivaanRanawat/ai-c...
Resources:
System Prompt - https://github.com/RivaanRanawat/ai-c...
utils/text.py truncate_text - https://github.com/RivaanRanawat/ai-c...
Thinking machines Blog - https://thinkingmachines.ai/blog/defe...
.ai-agent/tools/test_tool.py - https://github.com/RivaanRanawat/ai-c...
scripts/test_tool.py - https://github.com/RivaanRanawat/ai-c...
Timestamps:
(00:00:00) Introduction
(00:01:28) Project setup & Virtual Environment
(00:05:20) LLM Connection, OpenRouter & Response Steaming/Non-streaming
(01:01:09) Retrying Requests & Exp. Backoff
(01:07:59) Converting to CLI application using Click
(01:15:05) Run Single Mode, Agentic Loop Setup and Output Display using Rich
(02:05:35) Context Manager + System Prompt Walkthrough (Prompt engineering)
(02:30:46) Tool calling (Base Tool)
(03:09:17) Read File Tool
(03:48:31) Tool Registry - Registering tools, passing schemas to LLM
(04:34:55) Agentic Loop - Executing tools, managing context & displaying read_file tool on TUI (setup for other tools)
(06:13:08) Run Interactive Mode, Fixing context management errors
(06:29:22) Configuration System & Error Handling + AGENTS.md support + Turns in Agentic Loop
(07:32:00) Session
(07:44:21) Write File Tool
(08:25:08) Edit File Tool
(08:58:15) Shell Tool
(09:45:51)List Dir Tool
(10:03:11) Displaying Error Messages on TUI
(10:06:07) Grep vs Glob
(10:08:27) Grep Tool
(10:37:19) Glob Tool
(10:48:33) Web Search Tool
(11:03:18) Web Fetch Tool
(11:17:06) Todos/Planning Tool
(11:39:20) Memory Tool
(12:06:43) Updating the System Prompt
(12:15:41) Subagents
(13:02:55) Tool Discovery (Build Your Own Tool)
(13:30:27) MCP - Model Context Protocol
(14:41:22) Context Management - Compaction
(15:24:12) Context Management - Pruning
(15:38:32) Approval System
(16:32:00) Hooks
(17:14:26) Loop Detection
(17:39:50) Command Support on TUI
(18:16:12) Sessions vs Checkpoints
(18:18:27) Session Management
(18:55:01) Checkpoint Management
(19:04:10) Conclusion
Connect With Me Here:
GitHub: https://github.com/rivaanranawat
Linkedin: / rivaan-ranawat
Medium: / namanrivaan
X: https://x.com/RanawatRivaan
Instagram: / optimalcoding