Programming for AI

Many people stays with programming with AI, prompting a large language model (LLM) to write code. However, the opposite direction matters a lot, as the underlying AI coding agents rely on necessary tools for generating code, so that an LLM can produce more reliable outputs.

This site teaches programming for AI: how to write programs that an LLM can actually use. The programs will enhance the capabilities of AI tools and/or provide more concrete and precise information as context for AI generations.

Two directions

Programming with AI

is about how you build: using AI copilots, code generators, and chat assistants to write boilerplate and debug faster, accelerating traditional software development. Here, AI is the tool.

Programming for AI

is about what you build: accessing necessary data, engineering the data pipelines, and providing structural information that make AI possible in the first place. Here, AI is the user.

Foundation model

Before you start

This website demonstrates with Python. You do not need to be an expert. You do need:

  • Basic Python — you can read and write a Python program, run a script, and install a package with pip.
  • The command line — you can open a terminal and run a command.
  • A modern browser — the demos run Python and LLMs in your browser. The optional live model needs desktop Chrome with its built-in AI enabled.
  • No AI background needed — each page explains the interaction model as it goes. No machine learning or maths is assumed.
  • No data collected — as the executions all happen in browsers, no data will leave the browser, and the server can collect nothing.

Lessons

The lessons below introduce techniques for programming for AI. Each lesson builds on its own with a detailed introduction, scaffold code to adapt, and a concrete example for demonstration.