Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

PE101: Prompt Engineering from First Prompt to Coding Agents

In this course you write instructions for a large language model (LLM) and build checks for its answers. It is for programmers who have finished one programming course and haven’t built with an LLM before. A bicycle shop gives you a running example. Can a dispatcher tell a brake repair request from a request for the repair receipt, and how would you measure that?

You start by building a small language model. Then you write prompts, evaluate their outputs, and build programs that retrieve documents or call tools. In the last two modules you give a coding agent a task, review its changes, and configure its project instructions and permissions. The course is self-paced, with no deadlines and no grades: 13 modules, five assignments, three self-tests, and a capstone project.

The course calls no model. It needs no account, no API key, and no payment. Its labs build requests, read responses, and test the code around a model with stand-ins, programs that answer in the shape of a real model’s responses from a script. How the course teaches without a model explains what that covers and what it can’t.

Start with setting up your environment. If you are new to Python, read Python for the labs too.

The suggested pace links to all 13 modules and their assignments.

Learning objectives

By the end of the course, you can:

Each module’s objectives serve the course objective in brackets. Every exercise, lab, and self-test question names the objectives it tests.

Part 1: Foundations

Module 1: How language models produce text [LO-1]

Module 2: The anatomy of a request [LO-1]

Module 3: Clear instructions [LO-2]

Module 4: Structure, data, and templates [LO-2]

Part 2: Techniques and measurement

Module 5: Examples [LO-3]

Module 6: Reasoning and chains [LO-3]

Module 7: Evaluating prompts [LO-4]

Module 8: Structured output and tools [LO-5]

Part 3: Systems and agents

Module 9: Workflows and agents [LO-5]

Module 10: Documents, retrieval, and context [LO-6]

Module 11: Prompt injection [LO-7]

Module 12: Prompting a coding agent [LO-8]

Module 13: Configuring a coding agent [LO-8]

Prerequisites

You need one finished programming course in any language, such as Python, Java, JavaScript, or C, and some practice with Git and a terminal. You don’t need Python already: the labs are in Python, and Python for the labs teaches the Python they use. You don’t need any experience with language models.

Self-check. If you can do all five of these, in any language, you are ready:

  1. Write a function that takes a list of strings and a word, and returns the strings that contain the word; then test it with an assertion.

  2. Read a JSON file into a dictionary or map, and print one of its fields.

  3. Explain the difference between what a function returns and what it prints.

  4. Run a program from a terminal with a file path as its argument, and read its error message.

  5. Clone a Git repository, change a file, and commit the change.

How the course teaches without a model

The labs use local code and example responses, so you can repeat every exercise without an API account or a bill. Each type of exercise gives you different evidence about your work.

Your capstone project ends with an evaluation that is ready to run against a real model, and a report that says what you measured and what still needs a model.

Suggested pace

The course is self-paced, so it has no deadlines: take as long as you need. This pace takes 16 weeks at about 7.5 hours a week, about 120 hours in all. A module takes about 6 hours, as each module’s reading says: about 2 for the reading, 2.5 for the lab, and 1.5 for the practice. Module 1 takes about 7, because its lab and practice run longer. An assignment adds about 3 hours, a self-test about 2, and the capstone project about 20.

WeekTopicReadingThen
1How language models produce textModule 1
2The anatomy of a requestModule 2PA1
3Clear instructionsModule 3
4Structure, data, and templatesModule 4PA2, Self-test 1
5ExamplesModule 5
6Reasoning and chainsModule 6
7Evaluating promptsModule 7PA3
8Structured output and toolsModule 8Self-test 2
9Workflows and agentsModule 9PA4, capstone proposal
10Documents, retrieval, and contextModule 10
11Prompt injectionModule 11PA5, capstone milestone
12Prompting a coding agentModule 12
13Configuring a coding agentModule 13Self-test 3
14–16The capstone projectThe capstone briefFinal version

Checking your work

The course has no grades. Instead, every piece comes with a way to check it, so you can tell what you have learned and what to review:

PieceHow you check itObjectives
Labs 1–13Every check cell in the notebook passesEach lab’s module
PA1: Requests and costs (notebook)Its visible testsLO-2.1–2.4, LO-1.3
PA2: A prompt library (notebook)Its visible tests, and the prompt rubric for its promptsLO-3.1–3.3, LO-4.1–4.3, LO-2.1
PA3: An evaluated classifier (notebook)Its visible testsLO-5.1–5.3, LO-6.2, LO-7.1–7.4, LO-3.3
PA4: A tool-using assistant (notebook)Its visible tests, which drive your code with scripted stand-ins, and the scoring notes for Problem 5’s written answerLO-8.1–8.3, LO-9.1–9.3, LO-2.4, LO-6.3
PA5: Answers from documents, defended (notebook)Its visible tests, and the scoring notes for Problem 7’s reportLO-10.1–10.4, LO-11.1–11.3, LO-4.2, LO-7.3, LO-8.1
Self-test 1, after Module 4The answers and scoring notes in the pageModules 1–4
Self-test 2, after Module 8The answers and scoring notes in the pageModules 1–8, weighted toward 5–8
Self-test 3, after Module 13The answers and scoring notes in the pageAll modules, weighted toward 9–13
Capstone project: proposal, milestone, and final versionThe brief’s checklists and rubricLO-2.2, LO-3.1, LO-4.2, LO-4.3, LO-6.3, LO-7.1–7.4, LO-8.1, LO-9.3, LO-10.4, LO-11.2, LO-11.3, LO-12.1–12.3, LO-13.1–13.3

Later pieces revisit earlier objectives on purpose, so that you keep practicing them.

Policies

Course materials