Back to Events
Building Safe AI Agents with Guardrails
Completed

Building Safe AI Agents with Guardrails

January 6, 2026, 01:00 Europe/Berlin
Alexey Grigorev

Continue with the workshop writeup

Open the canonical pages, recording, materials, and code repo.

View workshop writeup

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:

The notebook you will build

The final notebook has guardrails around a tool-using FAQ agent:

flowchart LR USER["User question"] INPUT["Input topic guardrail"] FAQ["FAQ assistant agent"] SEARCH["search_faq tool<br/>minsearch index"] OUTPUT["Output safety guardrail"] ANSWER["User-facing answer"] OPENAI["OpenAI model calls"] USER --> INPUT INPUT -->|passes| FAQ INPUT -->|trips| ANSWER FAQ --> SEARCH FAQ --> OPENAI INPUT --> OPENAI OUTPUT --> OPENAI FAQ --> OUTPUT OUTPUT -->|passes| ANSWER OUTPUT -->|trips| ANSWER

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.