Building Safe AI Agents with Guardrails
Continue with the workshop writeup
Open the canonical pages, recording, materials, and code repo.
We start with a DataTalks.Club Data Engineering Zoomcamp FAQ assistant,
then add checks that keep the agent on topic, block unsafe responses, and
show how to cancel wasted work when a guardrail fails. The workshop uses
the OpenAI Agents SDK for built-in guardrails, then rebuilds the same
idea with tools and plain asyncio so you can use it with other agent
frameworks.
Links
The external resources:
- Related course: AI Bootcamp: From RAG to Agents
- FAQ data used by the agent
- AI Hero email course for the docs.py loader
- OpenAI Agents SDK guardrails documentation
The notebook you will build
The final notebook has guardrails around a tool-using FAQ agent:
The base agent can already search the FAQ, but it tries to answer unrelated questions too. The input guardrail blocks questions outside the course domain. The output guardrail checks the agent response for policy problems such as promising deadline extensions or writing homework for a student. The later parts show the same checks as tools and as a small async runner that can cancel work when a guardrail trips.