Building a Coding Agent From Scratch
Sketch the full harness: a headless core, six modules, TUI and remote modes, and an evals layer.
decode
Free open-source course
Learn harness engineering by building Claude Code from scratch.
From a bare-bones agent loop to a swarm of cloud agents.
Open-source harness engineering course
by Decoding AI in collaboration with Modal, Opik (by Comet), and Kitaru (by ZenML).
Then type /demo- and pick a demo. See what they do below. Full setup guide.
In LangChain's Terminal-Bench experiment, changing only the harness (with the same model) moved a coding agent from ~30th place into the top 5: the harness, not the model, is what makes a coding agent good.
That's the entire tool-calling agent. Everything else in this repo (the tools, skills, permission layer, sandbox, steering queue, memory, compaction, session recording & replay, remote execution, subagent fan-out, and evals) is the harness.
That's what you're here to build.
We spent months under the hood of Claude Code (via its leaked source), OpenCode, Pi, and Aider, then distilled what we learned into 8 articles and 6 videos where you'll build decode, your own coding agent, from scratch. One headless core hooked to two modes: an interactive TUI and Modal serverless functions running N copies in parallel, fired by CLI, webhook, or cron.
Warning: Building a coding harness from scratch can make you dangerously good at building any other AI product, whether in finance, medicine, or e-commerce.
From designing the harness to deploying a swarm of remote agents.
For the full experience, go through the articles and videos that cover what the code can't. The why behind every decision.
The finished agent ships with demo skills under .decode/skills/. Open the TUI, type /demo-, pick one, and watch the harness you're about to build do real work.
The code is written in Python, with the following frameworks and libraries:
Otherwise, we build all the functionality from scratch to teach you the foundations that last, not frameworks that abstract away the hard parts.
You finish with a working coding agent that teaches you harness engineering patterns to steal for your own agentic applications.
Running the code costs $0 if you stick to free tiers. Only reading? Everything's free!
One Python package; each module maps to one part of the architecture.
As an open-source course, it is entirely self-paced and based on this repository, plus the attached lessons that walk you through the code. No paywall. No platform.
Read the lessons on the Decoding AI Magazine, watch the videos on the Decoding AI Channel, run the code on your own machine, break it, fix it, and learn from the process.
The guides live under running_the_code/. Follow them in order; each ends with a link to the next.
Open a GitHub issue for course questions, setup trouble, or concept clarifications. Found a bug and know the fix? Fork, fix, run make ci (no API key needed), and open a pull request. Future readers will thank you 🤗
Special thanks to Modal, Opik (by Comet), and Kitaru (by ZenML) for sponsoring this open-source course and keeping it free!
Opik and Kitaru are open source. Consider starring their repositories: Opik on GitHub · Kitaru on GitHub.
No. The default Gemini provider has a free tier, OpenRouter routes across :free models, and Modal gives $30 in credits — see Cost Structure.
Accessibility: our audience knows Python. The course focuses on the design decisions, which transfer to any language.
Because adding custom logic to an existing harness is the easy part. Knowing what to add requires understanding the internals. Those fundamentals are what still make AI engineers valuable. Build a coding agent once and you're equipped to build a custom agent for any use case.
If you found this course useful, consider starring the repository so others can find it too.