← Back to Lesson 1

Before you start

Set up your notebook

Every lesson has a notebook that runs in your browser on Google Colab. To use it you need two API keys, one for Gemini and one for Tavily. Both are free to create. Setup takes about 10 minutes, and you don't need to install anything on your computer.

Already use Jupyter and want to run the notebooks on your own machine? Create your keys in step 1, then skip to Alternative: run it locally with Jupyter.

Create your two API keys

Gemini API key

This one runs the model in every lesson.

  1. Go to aistudio.google.com/apikey and sign in with your Google account.
  2. Click Create API key, then copy it.

It's free, and you don't need a card.

Tavily API key

This one runs web search, which you'll need from Lesson 3.

  1. Sign up at app.tavily.com.
  2. Copy the key from your dashboard. It starts with tvly-.

The free plan gives you 1,000 searches a month, and you don't need a card.

Save the keys in Colab

  1. Open the Lesson 1 notebook from the watch page.
  2. In the left sidebar, click the 🔑 key icon (Secrets).
  3. Click Add new secret. Set the name to GEMINI_API_KEY and paste your Gemini key as the value.
  4. Add a second secret. Set the name to TAVILY_API_KEY and paste your Tavily key.
  5. Turn on Notebook access for both keys.

Type the names exactly as shown: all caps, with underscores. The notebook looks for these exact names.

Run the setup cell

  1. Click ▶ on the first code cell.
  2. If Colab warns that the notebook wasn't written by Google, click Run anyway.
  3. If a pop-up asks to give the notebook access to your secrets, click Grant access.
  4. The first run takes a few minutes while it installs everything. When it's done, it prints ✓ Ready.
  5. Now run the cells in order, from top to bottom.

Every time you come back

  • Turn on Notebook access for both keys in any lesson you haven't opened before.
  • The setup cell reinstalls every session. Colab gives you a fresh machine each time, so expect the same few-minute install at the start.
  • To keep your changes, use File → Save a copy in Drive. Otherwise your edits are gone when you close the tab.

Troubleshooting

Add your GEMINI_API_KEY first

The notebook can't read your Gemini key. Open 🔑 and check two things:

  • the name is exactly GEMINI_API_KEY
  • Notebook access is on

Then run the setup cell again.

No TAVILY_API_KEY yet

The notebook can't read your Tavily key. The setup still finishes, and Lessons 1 and 2 don't use web search, so you can carry on. Before you start Lesson 3, open 🔑 and check:

  • TAVILY_API_KEY is there, with the name exactly as shown
  • Notebook access is on

Then run the setup cell again.

An error with 429 or RESOURCE_EXHAUSTED

You've hit a free-tier limit on your Gemini key. There are two kinds:

  • Per minute: wait a minute, then run the cell again.
  • Per day: the daily limit resets at midnight Pacific time. Carry on the next day, or turn on billing for your key in AI Studio if you want to keep going.

Optional

Alternative: run it locally with Jupyter

You don't need this if you're using Colab. It's for anyone who would rather run the notebooks on their own machine.

  1. Make a folder for the masterclass

    ai-engineering-masterclass/
    ├── .env                 ← your keys
    ├── notebooks/           ← the lesson notebooks go here
    └── demo-repo/           ← created for you on the first run
  2. Download each lesson notebook into notebooks/

    In Colab, use File → Download → Download .ipynb.

  3. Add your keys

    1. Download the example env file into ai-engineering-masterclass/.
    2. Rename it to .env.
    3. Paste your two keys into it.

    On a Mac, Finder hides files whose names start with a dot. Press Cmd + Shift + . to show them.

  4. Set up Python

    We tested with Python 3.12. Use a virtual environment so the masterclass packages stay separate from everything else. From inside ai-engineering-masterclass/, run:

    python3.12 -m venv .venv
    source .venv/bin/activate        # Windows: .venv\Scripts\activate
    pip install notebook
    jupyter notebook
  5. Run the setup cell

    Open a lesson from notebooks/ and run the setup cell. It installs the same package versions used in the videos and downloads the practice files into demo-repo/. Each time you come back, activate the environment again before you run jupyter notebook.