The End

Welcome!

  • You have just finished C$50 Finance and submitted your final project proposals. Today, we consider what happens to software engineering when writing the code is no longer the hard part.
  • This lecture is less about any one tool and more about a way of working. The tools will change; the ideas should last longer.
  • Recall that every problem set this semester handed you a precise specification: print exactly this seating chart, render an apology if shares isn’t a positive integer, redirect to / when done. Your job was to translate that English into C, Python, and SQL.
  • Notice that the prompts people type into AI tools are also written in English. In that sense, English has become a language in which programs are described, and you are already fluent in it.
  • The examples in this lecture are drawn from C$50 Finance, so that each is one you can read.

An Inversion

  • This semester, each problem set gave you a specification, and you produced the code. You were, in a sense, the compiler.
  • A model can now produce that code in seconds. So the job flips: you decide what to build, you write down what correct means, you draw the boundaries between pieces, and you verify the result.
  • Notice that, in that new chain of work, you appear three times (deciding, specifying, verifying), and none of those is typing the code.
  • Writing code is no longer the bottleneck. Formulating the problem, specifying it, and verifying the result are.

Large Language Models

  • A large language model (LLM) is a program that, given some text, predicts the most likely next token (a word or piece of a word), again and again.
  • It has no intent and checks no facts. It has seen a great deal of code and prose, and it continues the patterns it has seen.
  • Recall quote in app.py. If you type def quote():, a model can complete it: a form that takes a symbol, a call to lookup, a template rendered with the result.
  • Notice that it’s right because thousands of Flask apps look like that, not because it knows what lookup returns. At each line, the check the spec actually wants (a blank symbol, a lookup that returns None) is often the second most likely continuation, and so it’s left out.
  • In other words, a model gives you the probable, not necessarily the correct.

Chatbots and Turn-by-Turn Prompting

  • A chatbot (e.g., ChatGPT) puts a conversation on top of a model. You ask, it answers, you read the answer, you ask again.
  • Consider who’s doing the work in that loop: you read the code, you run it, you find the bug, you type the fix.
  • For example, you might ask, “Write /buy for my Flask app.” It returns a route that calls lookup, checks the user’s cash, and inserts a row. But it forgot that shares must be a positive integer, so -5 goes through.
  • So you type, “Render an apology if shares isn’t a positive integer.” And so on. If you kept a ledger of who did what, by the end the model would have two entries and you would have seven.
  • Many of you used exactly this loop during Finance. In the sections that follow, each of the steps you performed (reading, running, catching, re-prompting) is handed to the machine.
  • With a chatbot, the model writes, but you remain the debugger, the tester, and the glue.

Tool Calling and Execution Loops

  • Suppose we give the model tools: a shell, a file editor, a database client. Instead of printing code for you to paste, it emits a command, reads the output, and decides what to do next.
  • That loop of thinking, acting, and observing, run by the model rather than by you, is what makes it an agent.
  • For example, you say, “Implement /sell.” The agent edits app.py, runs flask run, submits the form, and gets a 500 error: it queried a shares column that doesn’t exist in the table you designed for buy.
  • It then runs .schema in sqlite3, fixes the query, and resubmits until it redirects to /. Notice that nobody pasted anything. Reading the error, which used to be your job, is now the agent’s.

The Agent Harness

  • The harness is everything around the model: which files it may touch, which commands it may run, and what it is told about your project before it starts.
  • The model proposes; the harness decides what is allowed and what is visible.
  • For example, before the agent touches finance.db, the harness can put the output of .schema into the model’s context, so that it knows users has id, username, hash, and cash rather than guessing.
  • And if the agent tries to DROP TABLE users to “start fresh,” the harness stops and asks you first, whereas a SELECT goes through. It’s the same model in each case; the harness made the difference.
  • Concretely, a harness is a handful of files on disk, in three categories:
    • Context, or what the model is told. A file such as AGENTS.md at the root of a project is read at the start of every session. For Finance, it might say that queries go through db.execute with ? placeholders, never f-strings. A SKILL.md holds instructions the agent loads only when a task matches its description.
    • Permissions, or what the model may run without asking. For example, a settings.json might read as follows:

      {
          "permissions": {
              "allow": ["Bash(flask run *)", "Bash(sqlite3 * .schema)"],
              "ask": ["Bash(sqlite3 *)"],
              "deny": ["Read(./.env)", "Bash(rm *)"]
          }
      }
      

      Notice that the rules are checked in order: deny first, then ask, then allow.

    • Sandbox, or what the model may touch: operating-system limits on which files and which network addresses the agent’s commands may reach.
  • Notice the distinction. The model reads AGENTS.md and SKILL.md and may follow them. The harness enforces permissions and the sandbox, and the model cannot change them. An instruction is something the model may follow; a permission is something it cannot change.
  • It is tempting to credit or blame “the model” for everything an agent does, but much of the engineering in these tools is in the harness. The duck in your codespace is a harness too.

Specifications and Acceptance Criteria

  • Rather than dictate the code, write down what correct means: the inputs, the outputs, and the conditions that must always hold. These are called acceptance criteria.
  • You’ve been reading specifications all semester. Now you write them.
  • For example, here is the buy section of the Finance spec, as acceptance criteria:
    1. symbol must be non-blank and must exist per lookup; otherwise, render an apology.
    2. shares must be a positive integer; otherwise, render an apology.
    3. If the user can’t afford the shares at the current price, render an apology without completing the purchase.
    4. On success, redirect to /.
  • Notice that each of those is a sentence from the Finance spec.
  • Notice too what the spec deliberately leaves out: it says you needn’t worry about race conditions. A good spec is as precise about what doesn’t matter as about what does.
  • If you can’t say what correct means, an agent can’t build it.

Deterministic Guardrails

  • Some rules are too important to ask for politely. Enforce them with tools that can’t be talked out of it: compilers, linters, type checkers, tests, check50.
  • Recall that the Finance hints say to use ? placeholders in db.execute and never to build a query with f-strings, format, or +, lest you risk a SQL injection attack.
  • Rather than remind the agent of that in every prompt, add a check that fails the build whenever a string is concatenated into a query. Now the agent can’t ship it.
  • Consider two versions of the same query, one built with an f-string and one with a ? placeholder. A prompt that says “please avoid SQL injection” lets both through. A scanner stops the first and passes the second.
  • You’ve been living with this all term: check50 and style50 don’t negotiate. A prompt is a request; a failing check is a boundary.

Verification Artifacts

  • When an agent writes a thousand lines, you won’t read them all. So rather than review the code, review the evidence that it works: test output, the database before and after, a screenshot, a recording. These are verification artifacts.
  • The question shifts from “is this code right?” to “does this evidence convince me?”
  • For example, to check history, don’t read the Jinja template. Run the spec’s own test plan, recorded: register, buy 10 shares of NFLX, sell 4, and open /history. You should see two rows, each saying bought or sold, with the symbol, the price, the shares, and the date and time.
  • If the recording shows that, history works, whatever the template looks like.
  • Notice that the “Testing” section of the Finance spec is already a list of verification artifacts.
  • Reading code doesn’t scale; evidence does. Verification, not writing, is now the bottleneck.

Multi-Agent Orchestration

  • Larger tasks can be split across several agents, each with one job and only the context it needs. One agent with everything in its head gets confused, much as one function that does everything does.
  • Deciding where to split is your job, and it’s the same skill as decomposing a program into functions.
  • For example, consider the spec’s “personal touch” of letting users buy and sell from index itself:
    • One agent reads the spec and writes down what changes: a form per row, posting to /buy and /sell.
    • One agent changes index.html and the routes.
    • One agent runs the spec’s test plan, including the “unexpected usage” cases: letters, zero, negatives, decimals, more shares than the user owns.
  • Notice that each agent sees only a few things, never the whole project, and that the last agent tests code it did not write.
  • Compare this to one agent doing all three jobs in order: everything it reads and writes piles up, and by the end it is carrying a dozen things and testing its own code. One agent could do it, but a shorter context and fresh eyes are the same reasons we write small functions.
  • Good agent architecture looks like good software architecture.

The Software Factory

  • Put all of this in the cloud and connect it to your repository. An issue comes in; a sandbox spins up; agents plan, implement, and test; and a pull request comes out with a summary of what changed and why. No one’s laptop is involved.
  • For example, suppose someone files an issue: “Let users add cash to their account” (another of the spec’s personal touches). The factory then proceeds through a pipeline:
    1. Issue. Someone writes down what they want.
    2. Sandbox. A clean machine in the cloud with the repository checked out, thrown away afterward.
    3. Plan. An agent reads the issue and the code and writes down the change before making it: add /deposit, positive numbers only, UPDATE users SET cash = cash + ?.
    4. Implement. The change itself, on a branch of its own.
    5. Test. The spec’s test plan plus the new case: a $500 deposit raises cash by exactly 500.00; a deposit of -5 renders an apology; check50 passes.
    6. Pull request. A summary of what changed and why, with the test results attached. This is where you come in.
  • Notice that a person files the issue and a person reviews the pull request; the machine does the rest.
  • The repository in which this lecture’s slides live was built this way, issue to branch to pull request, with an agent doing the work and a human deciding and reviewing.
  • Software engineering thus splits in two: deciding what to build, and building the factory that builds it.

Human Approval Gates

  • Where must a person sign off, and where may the machine proceed on its own? A dark factory is one with no people in it at all. For anything that matters, you want people in it.
  • Drawing that line is a design decision, and someone is accountable for it.
  • For example, the factory might restyle layout.html or fix a typo in apology.html on its own.
  • But anything that touches generate_password_hash, session, or the UPDATE users SET cash in buy and sell should wait for a human to read the diff and approve.
  • Autonomy, then, is a dial rather than a switch. Turned all the way one way, everything waits on you, and you are the bottleneck. Turned all the way the other way, nobody is watching.
  • Notice that “should this wait for a person?” is itself a decision, and it needn’t be made by the same model that writes the code. Some newer models are built for this kind of judgment. Jev, from the startup TypeSafe, doesn’t generate text at all. Given some state and a question, it returns a typed answer (a choice from a list, a score on a rubric, or a true/false) along with a calibrated probability that the answer is right. Your code can then set a threshold: above it, the change ships on its own; below it, a human reads the diff.
  • The machine can do the work. You remain responsible for it.

Where the Effort Goes

  • Consider how your job changes across the three eras we’ve discussed:

      You interact with The AI does You do
    Chatbot A chat window Writes snippets on request Read, run, and patch, turn by turn
    Agent Your editor and terminal Runs tools, edits files, iterates Supply context, steer, review diffs
    Factory Issues and pull requests Takes an issue to a tested PR Write the spec, set the guardrails, judge the evidence
  • Notice that, reading the rightmost column from top to bottom, your job moves up a level with each row.
  • Put another way, imagine the hours you spent on a problem set this semester as a bar: most of it writing code, some of it reading and patching, a little of it specifying and verifying. With a chatbot, the writing shrinks but the patching grows. With an agent, most of your time goes to steering. In a factory, nearly all of it goes to specifying, setting guardrails, and judging evidence.
  • The exact proportions are illustrative; the shape is the point. The work that grows is the work this course taught you to do.
  • You might wonder whether cheaper code means less work for engineers. Economists have a name for why it tends not to. In 1865, William Stanley Jevons observed in The Coal Question that more efficient steam engines had led Britain to burn more coal, not less: when each unit of work costs less, people find more uses for it. This came to be called the Jevons paradox.
  • The same likely holds for code. When a feature that took a week takes an afternoon, the result is not less engineering but more software being asked for, and each piece of it still needs someone to say what correct means and to check that it is.

What Doesn’t Go Away

  • Understanding. You can’t judge whether an agent’s SQL or its memory management is right without knowing how databases and memory work. That’s Weeks 4 and 7.
  • Design. Deciding how to split a system into pieces that don’t know too much about each other. That’s every problem set since Week 1.
  • Skepticism. Writing the tests the agent didn’t think of. That’s the “unexpected usage” list in every spec.
  • In other words, CS50 is not what the machine replaces; it is what lets you supervise the machine.
  • For your final project, don’t use AI to write the same project faster. Use it to build something more ambitious, and make sure you could still explain every piece of it. That is also the course’s academic honesty policy in one sentence: you must understand what you submit.

Putting It Together

  • We ended by building something with an agent, live. The particulars of what we built matter less than the steps, which apply to any project, your final project included:
    1. Ask before building. A vague request (“build me a simple game that works with a controller”) is not a specification. A good agent, like a good engineer, names what it cannot infer and asks about it first.
    2. Decide what you’re building and what you’re not. Write down the acceptance criteria, and write down what’s deliberately left out, as the Finance spec does with race conditions.
    3. Draw the boundaries. Split the system into pieces that each have one job and know as little as possible about the others. That’s your decision, and it’s the same decision as splitting a program into functions.
    4. Find the riskiest assumption. Most of what you build will be things you’ve done before; one part won’t be. Before writing anything else, write the smallest experiment that shows whether that part works. Ten minutes there can save a day.
    5. Verify with evidence. Pair each requirement with the artifact that will prove it: a line in a log, a number on the screen, a passing test. Then look at the evidence rather than read the code.
    6. Keep the fundamentals. When the agent’s output misbehaves, what’s missing is often something small and familiar from Week 1. Knowing what to look for is what lets you fix it in one sentence.
  • The agent wrote the boilerplate. The result worked because we drew the boundaries, we wrote down what correct means, and we checked the riskiest part before trusting it. That is the job now.

Looking Ahead

  • As you journey from the work of this course to the world outside CS50, you may want to take a number of steps to prepare and adventure out.
  • Download and learn about VS Code, which is what CS50.dev runs. Editors built around agents include Cursor, Zed, Google Antigravity, and Devin Desktop (formerly Windsurf).
  • To be able to execute commands on the terminal, much like you did on CS50.dev, install command-line tools on your Mac or PC.
  • Try a coding agent in that terminal. As of this writing, the most widely used are Claude Code, GitHub Copilot, Codex, and Cursor, per the 2026 Stack Overflow Developer Survey. OpenCode is open source and works with any model. Notice that each reads a file at the root of your project (AGENTS.md or CLAUDE.md) and asks before running a command it hasn’t been allowed. That’s the harness from this lecture, and you can configure it.
  • Most of those tools also run in the cloud: assign an issue to Codex, Devin, or Copilot, and a pull request comes back. That’s the software factory. Read the pull request as carefully as you’d want yours read.
  • Ask questions using AI-based tools like ChatGPT, Claude, or Gemini.
  • Not every model is a chatbot. Jev, from TypeSafe, returns typed decisions (a choice, a score, a true/false) with a calibrated probability, so that software can tell when to act on its own and when to defer to a person. It is named for Jevons: its makers expect that as decisions get cheaper, software will find many more places to make them. Expect more models built to be called by code rather than talked to.
  • Learn more about Git.
  • Host a website using GitHub.
  • If applicable, host a web app using AWS, Azure, Google Cloud, Cloudflare, Heroku, or Vercel.
  • Ask questions in relevant online communities.
  • Take any of our other CS50 courses.
  • Join one of our many communities.

Summing Up

In this lesson, you learned what changes about software engineering when a model can write the code, and what doesn’t. Specifically, we discussed…

  • Large language models and chatbots
  • Tool calling, agents, and the harness around them
  • Specifications and acceptance criteria
  • Deterministic guardrails
  • Verification artifacts
  • Multi-agent orchestration and the software factory
  • Human approval gates
  • The Jevons paradox
  • What doesn’t go away: understanding, design, and skepticism

The slides, and how they were built, are at github.com/cs50/agentic-demo.

This was CS50!