Overview and setup
The coding agent you will build
We build a small coding agent for Python and Django projects.
The target experience is similar to a project bootstrapper. You give it a
short instruction like to-do list. It reads a working Django template and
plans the changes. Then it edits files, runs safe checks, and gives you a
project you can start with make run.
We are not trying to compete with a product like Lovable. Lovable has a team and a polished interface. It also has a prepared React template, streaming, browser preview, and many safety checks.
We are building the smaller version so you can see the moving parts:
- a template
- a set of file tools
- a developer prompt
- an agent runner
The final shape looks like this.
We start with the OpenAI tool-calling mechanics because a coding agent is
still an agent. The model decides which tool to call, your code executes that
tool, and the result goes back into the conversation.
Then we let ToyAIKit handle the loop so we can focus on the coding-agent
pieces.
Links
The main resources for this workshop:
- Workshop recording
- Workshop code
- ToyAIKit
- Django template repo
- Todo app made with Z.AI
- Related course: AI Bootcamp: From RAG to Agents
- Related workshop: Hands-on with AI Agents and MCP
Prerequisites
You need basic Python programming and enough command-line comfort to run
Jupyter, install packages, and start a Django server. The workshop hides some
of the lower-level agent loop inside ToyAIKit. You do not need to know the
OpenAI Responses API deeply before starting.
You may need these accounts and keys.
- OpenAI API key
- GitHub account if you want to use Codespaces
- Anthropic API key if you want to try the Claude example
- Z.AI API key if you want to try the GLM example
You need these local tools.
- Python
pipuv- Jupyter Notebook
makeif you want to use the providedMakefile- Git
OpenAI is the only required provider. The optional examples also show
Anthropic through PydanticAI and Z.AI through the OpenAI-compatible chat
completions API.
OpenAI key setup
Create an API key in the OpenAI dashboard. You will only see the value once, so copy it into a safe place when it appears.
If you work locally, export the key before starting Jupyter:
export OPENAI_API_KEY='YOUR_KEY'
If you work in GitHub Codespaces, store it as a Codespaces secret:
- Create a GitHub repository, with a
README.mdif you want an easy starting point. - Open the repository settings.
- Go to
Secrets and variables, thenCodespaces. - Click
New repository secret. - Use
OPENAI_API_KEYas the name. - Paste your key as the secret value.
- Create a new codespace from the repository.
Codespaces is convenient because everyone gets a similar Linux environment with Python already available. A local environment is also fine. Nothing in this workshop depends on Codespaces specifically.
Install the workshop packages
Open a terminal in your environment. In VS Code you can use the integrated terminal. Codespaces works from desktop VS Code or from the browser.
Install the packages with these commands.
pip install jupyter django uv openai toyaikit
Upgrade ToyAIKit if you already had an older version installed:
pip install -U toyaikit
Use at least toyaikit 0.0.3. The workshop relies on the chat
interface, tool wrapper, and runner classes from that library.
Start Jupyter
Start Jupyter from the same terminal:
jupyter notebook
If you use Codespaces or a remote VS Code session, VS Code should forward
the Jupyter port automatically. If it does not, open the Ports panel and
forward the port printed by Jupyter, usually 8888.
Create a new notebook. Next, start with a small OpenAI example so the
tool-calling mechanics are visible before we hand the loop to ToyAIKit.
Continue with Part 1: OpenAI function calling recap.