Introduction
Welcome! In this workshop you build an AI agent from scratch, measure how well it works, then attack it and make it safe.
You will build an assistant for the Lumen AI Summit, a made-up two-day conference. Attendees can ask it about sessions, the venue and their own registrations, and it can register them for sessions. It is small enough to understand completely and realistic enough to have real security problems.
Why from scratch?
Section titled “Why from scratch?”Frameworks and protocols such as LangChain and MCP are great. They also hide what an agent actually is. Here you write the core yourself in about 50 lines of Python. Afterwards, every agent framework will make more sense, because you will recognize the loop inside it.
What you will learn
Section titled “What you will learn”| Part | Module | You will |
|---|---|---|
| Build | 1. Your first model call | Talk to a model over plain HTTP and keep a conversation going |
| Build | 2. Give it tools | Describe tools with JSON schemas and run the tool calls a model asks for |
| Build | 3. The agent loop | Let the model call tools repeatedly until it can answer |
| Evaluate | 4. Evaluate your agent | Write a test set, automatic checks and an LLM judge |
| Secure | 5. Attack: capture the flags | Exploit prompt injection, data leakage and tool misuse |
| Secure | 6. Defend and prove it | Add layered defenses and turn your attacks into tests |
What you need
Section titled “What you need”- A laptop with 8 GB of RAM or more (16 GB is more comfortable)
- Python 3.10 or newer
- About 4 GB of free disk space for a local model
- Some Python experience. You should be comfortable reading functions, lists and dictionaries.
No AI experience is needed, and you do not need an account with any AI provider.
How each module works
Section titled “How each module works”Each module has a page on this site and a folder in the code/ directory:
code/├── agentlab/ shared helpers, tools and event data├── 01-first-conversation/│ ├── starter/ the file you edit│ └── solution/ the finished version├── 02-tools/├── 03-agent-loop/├── 04-evaluate/├── 05-attack/└── 06-defend/Open the starter file, fill in the TODO comments, and run it. If you get stuck or fall behind, run the solution and keep going. Nobody gets left behind.
Ready? Head to Setup.