Have you ever wondered how exactly Claude Code, OpenCode, or Pi work under the hood? That’s probably very complex software, built by a team of the most experienced engineers, and there is no way mere mortals can write one. Right?
Wrong! Under the hood, there is just a simple "while (true)" loop and one API request. And we can build one live!
We’ll start from an empty Dart project and a plain chat in the terminal. Then we’ll give the model a few tools (to make it useful) and let it call them in a loop until the task is done. By the end of the stream, you’ll have a small agent where you understand every line.
Bring your questions to the chat, I’ll answer them as we go. Let’s get our hands dirty!
===
Repo: github.com/olexale/dart_pi
===
00:00 - Introduction
00:50 - Demystifying AI Coding Agents
04:18 - Creating the Dart CLI Project Setup
18:19 - Initial API Call & Troubleshooting Endpoint Issues
27:37 - CLI Interactive Loop
31:05 - Introducing Agent
42:07 - Implementing System Prompts Support
45:33 - Understanding Tools
57:12 - Building the GetForecast Tool Example
01:15:01 - Building Directory Listing Tool
01:20:30 - Building File Reading Tool
01:26:42 - Wrap-up