< all projects23 steps · medium · Rebuild · Premium
Build a pi-style coding agent
You will have built a small coding agent in the shape of pi, one function at a time, on a real model: 5 functions that are its tools over a repo (read with line numbers, edit by exact replacement, search, run the tests), 4 that describe the tools to the model and run the one it asks for, 2 that write the system prompt and pick up the repo's own notes, 3 that take one turn, 4 that compact a conversation that has grown too long, 2 that are the loop, and 3 that save a session and pick it up again. Each step is a few lines with its own tests, and the earlier functions are provided to the later ones. The model is handed to you as `model`, with one method, `chat(messages, tools, system, max_tokens)`, and it is real: the steps that call it check what it did (it picked the right tool, the repo's tests pass after the run, the summary kept the file name) and spend a little of your credits. pi is Mario Zechner's coding agent, small on purpose: a handful of tools, a short system prompt, sessions you can resume, compaction when the context fills. This is a simpler cut of the same design. It has no shell; in its place is a tool that runs the repo's tests. When every step has passed, the seven files assemble into one agent and you can hand it a task on a practice repo, live.
A Premium project.
Its steps, tests and tutor open with Deep-Agnt Premium. Every problem stays free.
See PremiumPart 01 · 5 steps
Tools
What the agent can do to a repo: read, edit, search, run the tests.
Part 02 · 4 steps
The toolbox
Describe the tools to the model, and run the one it asks for.
Part 03 · 2 steps
The system prompt
What the model is told before the task, with the repo's own notes.
Part 04 · 3 steps
One turn
Ask the model, run what it asked for, send the results back.
Part 05 · 4 steps
Compaction
Summarise the old part of a conversation that has grown too long.
Part 06 · 2 steps
The loop
Turns until the model answers.
Part 07 · 3 steps
Sessions
Save a conversation and pick it up again.