Repository for Implementing AI Agents in Python hands-on workshop
These instructions will guide you through configuring a GitHub Codespaces environment that you can use to run the course labs.
1. Change your codespace's default timeout from 30 minutes to longer. To do this, when logged in to GitHub, go to https://github.com/settings/codespaces and scroll down on that page until you see the Default idle timeout section. Adjust the value as desired.
2. Click on the button below to start a new codespace from this repository.
3. Then click on the option to create a new codespace.
This will run for several minutes while it gets everything ready.
If VS Code shows a workspace trust prompt, click Trust Folder & Continue.
The codespace may open in Restricted Mode with a banner asking whether you trust the authors of the files. Click Trust Folder & Continue.
After the initial startup, it will run a script to setup the python environment, install needed python pieces, install Ollama, and then download the models we will use. This will take several more minutes to run. It will look like this while this is running.
The codespace is ready to use when you see a prompt like the one shown below in its terminal.
4. Get a free API key for Groq to enable use of more powerful models for Labs 3 and 4.
Labs 3 and 4 need a model larger than the codespace can run. Groq hosts one free (no credit card). The other labs run entirely on the local model.
a. In a browser, go to https://console.groq.com and create an account. (If you have an email with a button to confirm, make sure the link is trying to open in the same browser where you were using groq before. If not, you can copy the link from the "click here" section and paste into the right browser.)
b. In the top right of the Groq screen, click on API Keys
c. Then click the Create API Key button.
d. Fill in the information, verify you're human if asked, and click Submit.
e. Copy the key (you can't view it again later).
5. Setup your groq key in your codespace.
Back in the codespace TERMINAL, run the command below to set your key for all terminals. Paste your key when prompted and then hit Enter:
source scripts/setup-key.sh
Afterwards, you should see output that indicates two environment variables (AGENT_PROVIDER and GROQ_API_KEY) are set.
To confirm the key works and that the lab models are reachable, run:
bash scripts/check-groq.sh
You should see OK for Lab 3 and Lab 4. If either reports FAIL because Groq has retired that model, the script checks a replacement for you and prints the exact export AGENT_MODEL=... line to run - or tells you to unset AGENT_PROVIDER and use the local model if nothing hosted is available.
6. Run the warm-up script for faster LLM interactions.
This loads the local model into memory and pre-downloads the embedding model Lab 4 needs, so neither download happens in the middle of a lab.
python scripts/warmup.py --embed --keep-alive 300m --auto-pull &
After this runs, you'll see a READY FOR WORKSHOP! message. You can just hit Enter to get back to a prompt.
(If you happen to hit an error where the script gets interrupted, just run it again.)
7. Open up the labs.md file so you can follow along with the labs. You can either open it in a separate browser instance or open it in the codespace.
Now, you are ready for the labs!
NOTE: If your codespace times out and you need to reopen it
- Go to https://github.com/your_github_userid/codespaces
- Find the codespace in the list, right-click, and select Open in browser
- Repeat steps 5 & 6 from the main section above to set the Groq env keys and run the warmup script again.












