Colvin says AI applications still need to be reliable and scalable, and that building them can be harder when generative AI is involved. Type-safe frameworks help developers refactor with confidence, and let coding agents use type checking to catch mistakes.
Human seeded Evals
Speaker
Samuel Colvin of Pydantic explains how type safety, agent loops, and observability can help developers build reliable AI applications at AI Engineer.
Colvin describes an agent as a loop that calls an LLM, runs its requested tools, updates state, and calls the LLM again. He points out that the loop needs an exit condition, such as a plain-text response, a designated final-result tool, or structured output.
Colvin demonstrates extracting a person record from unstructured text with Pydantic AI. When validation rejects a birth year of 1987 because the example requires a year before 1900, the error is sent back to the model, which retries with a valid date.
The agent result is typed as a Person, with Pydantic validation checking the output at runtime. Colvin then shows memory-recording and retrieval tools whose dependencies are also typed, so mismatched attributes or dependency objects produce typing errors.
Using Logfire, Colvin inspects a failed memory retrieval: the query “your name” did not match the stored text, while “name” did. The trace also shows call timing and pricing, both across the run and for individual spans.
Takeaways
- Use typed schemas so model outputs can be validated and application changes are easier to refactor.
- Define an explicit stopping condition for every agent loop.
- Return useful validation errors to the model when a retry could correct the output.
- Type tool dependencies to catch mismatches before runtime.
- Trace agent calls to diagnose failures and review latency and cost.
Mentioned in this talk
Search inside this talk
What was claimed 8
- built
Pydantic built
Pydantic Logfire
“our observability platform”
YouTube Verified3 sources· Talk, Web· archived
- built
Pydantic built
Pydantic AI
“use Pydantic AI”
YouTube Verified4 sources· Talk, GitHub, Web· archived
- works atSamuel Colvin works at
Pydantic
runs the company“I'm Samuel from Pydantic”
0:01inFrom Stateless Nightmares to Durable AgentsYouTube Unverified3 sources· Talk
- feature
Pydantic AI: Validates structured model output and returns validation errors to the model for retries
“Pydantic AI performs validation”
YouTube Unverified1 source· Talk
- uses
“We also instrumented this code with Logfire”
YouTube Unverified1 source· Talk
- uses
Pydantic AI uses
Gemini
“two calls to Gemini here”
YouTube Unverified1 source· Talk
- feature
Pydantic Logfire: Shows agent calls, tool exchanges, trace timing, and pricing
“we can see exactly what happened”
YouTube Unverified1 source· Talk
- feature
Pydantic AI: Supports type-safe agent outputs and dependencies for tools
“the agent's output type is generic”
YouTube Unverified1 source· Talk









