Pi Coding Agent for Beginners / Chapter 1 — Getting to Know Pi (lessons 1–4) / Lesson 1

What Pi Is

Time needed: about 6 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

Pi is an AI agent that runs in your terminal

Pi is an AI agent you use from the terminal. Start pi in the folder you want to work in and tell it the goal: it reads files, runs commands, and edits files as it works through multi-step tasks. It isn't only for code; it also works on notes, writing, and data files. Pi is made by Earendil and is open source under the MIT license. This course was checked against Pi 1.6.1.

One run is a loop of turns

Your message is sent to the model together with the system prompt, the conversation so far, and the list of available tools. The model's reply contains text and tool calls; Pi runs each call and records the result. That is one turn. If the results need another model request, Pi starts the next turn, and the run ends once the model stops calling tools. The code below imitates this flow with a scripted model.

editor.py

Tab indents. To leave the editor, press Esc, then Tab.

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.