Skip to main contentSkip to navigation

AI Hub CodeLabs

Build, Break and Defend an AI Agent Team

Build a team of AI agents that runs a college help desk, put it on the cloud, try to break other participants' agents, then defend your own.

  • 5 h
  • Intermediate
  • Python, Google Agent Development Kit (ADK), Gemini, Cloud Run
  • Starter code
Step 1 of 19: Overview

Step 1 · 10 min

Overview

Today you'll build a team of AI helpers, put it online, and then play capture the flag with the rest of the room: everyone tries to trick everyone else's desk into giving up its secrets. Then you'll make yours hard to crack.

Most AI demos stop at a chatbot: you type, a model answers. Real systems look things up, take actions, check their own work, and hold up when someone tries to trick them. That's what you're building.

You'll build the Campus Desk, a help desk for Ridgeview Polytechnic, a college we made up for this lab. Students ask it about policies and book appointments with their academic advisor. Behind the desk sits a small team of AI agents, each with one job.

An agent is a language model that can use tools and decide what to do next. A tool is a function the agent is allowed to call, like "search the handbook" or "book an appointment". The model reads the request, picks a tool, reads the result, and decides whether it's done.

How an agent works

  1. A student asks a question.
  2. The model reads it and decides it needs the handbook.
  3. So it calls a tool: a function it is allowed to use.
  4. The tool sends back what it found.
  5. The model decides it has enough, and answers.

The team

AgentIts jobIts tools
Front deskReads each request and sends it to the right specialistNone. It hands off.
Policy agentAnswers questions from the student handbooksearch_handbook
Booking agentBooks advising appointmentslist_open_slots, book_appointment, lookup_student
ReviewerChecks every reply before a student sees itNone. It reads and decides.

You'll build the team the way you'd build any system you want to trust: one piece at a time, testing each piece before you add the next.

How the day runs

  1. Build the team and run it on your laptop.
  2. Measure it with evaluations: a test suite for agents that gives you a score.
  3. Ship it to Google Cloud, so it has a public web address.
  4. Play capture the flag. Every desk hides five secret codes, called flags. You'll try to trick other participants' desks into revealing theirs, while they go after yours. (Security teams call this a red-team round.)
  5. Fix it. You'll patch your agents and watch the tricks stop working.

What you'll learn

  • How to build agents and give them tools with Google's Agent Development Kit (ADK), an open-source Python framework for building agents
  • How a router agent hands work to specialist agents
  • How a reviewer agent checks another agent's work, using structured output
  • How to measure an agent with evaluations
  • How to deploy agents to Cloud Run, Google's service for running containers
  • What prompt injection is, and the defences that actually hold: least privilege, human approval, and checks in code

What you need

  • A laptop with a web browser
  • A Google Cloud project with billing turned on. The four "Before the day" steps walk you through it. Please do them before you arrive.
  • Comfort with basic Python and a terminal. You don't need any experience with agents or the cloud.