WhoBuilt

Human seeded Evals

Jul 25, 2025· 12 min· 3.4K views·Watch on YouTube

Speaker

Samuel Colvin of Pydantic explains how type safety, agent loops, and observability can help developers build reliable AI applications at AI Engineer.

Type safety supports faster refactoring

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.

An agent needs a clear stopping rule

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.

Validation errors can guide a retry

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.

Typed tools and dependencies aid refactoring

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.

Tracing helps explain failures

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

Related talks