A batteries-included Python coding-agent runtime usable from the terminal, an HTTP/WebSocket server, and Telegram.
decodingai-magazine/building-a-coding-agent-from-scratch-course
A free, open-source course that teaches harness engineering by building a Claude Code-style coding agent from scratch in Python.
Open-source alternative to:Claude Code
- Stars
- 1,129
- Forks
- 267
- Open issues
- 6
- Last commit
- 14 days ago
What is it?
This course walks through building a coding agent called decode, from a bare agent loop up to a fleet of cloud agents. The core is a headless harness: the tool-calling loop, tools for file I/O, bash, grep and edits, a permission layer, and a sandbox. The harness is wrapped in two interfaces, an interactive terminal UI and remote runs on Modal serverless functions that can be triggered by CLI, webhook or cron.
The course also covers context engineering (memory files, skills, compaction, LSP diagnostics), subagents that fan out in parallel, and evaluation. Evals use benchmarks and regression suites traced in Opik, while session recording and replay are handled through Kitaru. Model providers include Modal-hosted open weights, OpenRouter and Gemini.
The material is delivered as 8 written lessons and 6 videos, with setup guides in the repository. Code is written in Python on Pydantic AI, and the components are built by hand rather than taken from frameworks.
Key features
- 01Builds a tool-calling agent loop with read, edit, bash, grep and other tools.
- 02Runs the agent in a terminal UI or headless on Modal serverless functions.
- 03Executes tool commands in local Docker or remote Modal sandboxes.
- 04Includes a permission layer with allow, ask and deny rules.
- 05Covers context engineering: memory files, skills and auto-compaction.
- 06Provides eval tooling with benchmarks and regression tests traced in Opik.
Use cases
- Learning how production coding agents like Claude Code are structured internally.
- Building a custom agent for a domain other than coding, using the same harness patterns.
- Running open-weight models served on Modal as the backend for an agent.
- Practicing agent evaluation with benchmarks and regression suites.
Quick start
- 1
Clone the repository
git clone https://github.com/decodingai-magazine/building-a-coding-agent-from-scratch-course.git - 2
Install dependencies from inside the project folder
make install - 3
Copy the example env file, then set your LLM API key in it
cp .env.example .env - 4
Start the decode agent in the terminal
uv run decode
Things to know
- Running the agent requires an LLM API key from Gemini, OpenRouter, or Modal.
- Some features depend on third-party services such as Modal, Opik, and Kitaru.
In collections
Topics
FAQ
- What is building-a-coding-agent-from-scratch-course?
- A free, open-source course that teaches harness engineering by building a Claude Code-style coding agent from scratch in Python. This course walks through building a coding agent called decode, from a bare agent loop up to a fleet of cloud agents. The core is a headless harness: the tool-calling loop, tools for file I/O, bash, grep and edits, a permission layer, and a sandbox. The harness is wrapped in two interfaces, an interactive terminal UI and remote runs on Modal serverless functions that can be triggered by CLI, webhook or cron.
- Is building-a-coding-agent-from-scratch-course free to use? What license does it have?
- building-a-coding-agent-from-scratch-course is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is building-a-coding-agent-from-scratch-course still maintained?
- Actively maintained. The last commit to building-a-coding-agent-from-scratch-course was on Oct 24, 2026.
- What can I use building-a-coding-agent-from-scratch-course for?
- Learning how production coding agents like Claude Code are structured internally. Building a custom agent for a domain other than coding, using the same harness patterns. Running open-weight models served on Modal as the backend for an agent. Practicing agent evaluation with benchmarks and regression suites.
- How do I install building-a-coding-agent-from-scratch-course?
- Clone the repository: git clone https://github.com/decodingai-magazine/building-a-coding-agent-from-scratch-course.git Install dependencies from inside the project folder: make install Copy the example env file, then set your LLM API key in it: cp .env.example .env Start the decode agent in the terminal: uv run decode
- Where can I get building-a-coding-agent-from-scratch-course?
- The source code and installation instructions are on GitHub: https://github.com/decodingai-magazine/building-a-coding-agent-from-scratch-course
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
Pi, the AI coding agent, compiled ahead of time to native code so it starts faster and uses less CPU than Pi on Bun or Node.
A desktop coding agent (Tauri app plus CLI) that runs on your existing AI subscriptions or local models, with built-in code search and verification checks.
A coding agent built on pi that routes routine decisions, like permission checks and context pruning, to a small judge model so the main model can focus on code.
A non-official Chinese learning handbook for the Pi Coding Agent terminal harness, covering setup through Skills, Extensions, Subagents and long-running workflows.
A 17-lesson Python tutorial that builds a Claude Code-like agent harness from scratch, starting with a single loop and bash.