Feb 6, 2025 · 1h 2m · latent-space
Agent Engineering with Pydantic + Graphs — with Samuel Colvin, CEO of Pydantic Logfire
gold bands on the timeline = statements, start to end. Hover to read, click to jump. CC turns on captions
In this episode, Pydantic founder Samuel Colvin joins Alessio Fanelli and Swix to explore Pydantic's expansion into artificial intelligence, detailing Pydantic AI's type-safe agent graph architecture, the performance optimizations behind Pydantic V2 and V3, and Logfire's high-throughput observability platform.
How this conversation actually went
Every chapter scored 0–10 on four independent dynamics. Hover any point for the reasoning behind the score. The hosts hold 30.6% of the talking time here. How this is scored →
speaking balance: gold is the hosts, purple is the guest (3 minute bins)
Samuel forcefully refutes optimistic claims about exponential model improvements, arguing that agents and graphs are merely temporary guardrails compensating for models lacking sufficient intelligence.
Hardest push from the hosts ▶ 29:01 Swyx challenges Pydantic AI for re-implementing model adaptersSwyx delivers an extended critique pressing Samuel on why Pydantic AI reimplements model adaptation rather than relying on dedicated gateways like LiteLLM or Portkey.
Biggest teaching moment ▶ 44:51 Samuel breaks down why ClickHouse failed for Logfire's span query engineSamuel details specific interval comparison bugs in ClickHouse and demonstrates how building custom kernels on Apache DataFusion in Rust resolved their analytical storage needs.
The host holds their own ▶ 16:52 Swyx leverages Temporal experience to evaluate Pydantic AI orchestration boundariesSwyx utilizes his background as a former Temporal team member and investor to dissect the boundary tradeoffs between code-level control flow, process isolation, and infrastructure orchestration.
the scores for every segment, with the reasoning behind each
| Chapter | Topic | The hosts as informed peer | Guest teaching | Guest disagreement | The hosts pushing back | Why |
|---|---|---|---|---|---|---|
| JSON Schema Adoption and Pydantic V2/V3 Performance Roadmap | 5 | 5 | 2 | 2 | Alessio and Swyx inquire about JSON Schema origin stories and compare Pydantic's lifecycle to Javascript validation libraries like Zod. Samuel details the internal Rust architecture planned for V3 and how JSON schemas became integrated via FastAPI. | |
| Transitioning to a Startup and Model Latency Impact | 4 | 6 | 1 | 1 | Alessio asks how Pydantic transitioned focus to GenAI tooling. Samuel explains how the core V2 Rust rewrite resulted in a 20% reduction in time-to-first-token for major LLM provider SDKs. | |
| Launching Pydantic AI and Elevating Framework Standards | 4 | 6 | 4 | 1 | Samuel sharply critiques recent opportunism and poor software engineering standards across the existing agent framework ecosystem, detailing how Pydantic AI enforces type safety, generics, and runnable docstring tests. | |
| Pydantic AI Architecture and Type-Safe Workflow Graphs | 5 | 5 | 3 | 2 | Alessio and Swyx drill into graph representations and type safety. Samuel explains how he shifted from being cynical about graphs to using node dataclass return type introspection for compile-time type safety. | |
| Workflow Orchestration, Distributed State, and Cloudflare Workers | 7 | 4 | 2 | 5 | Swyx brings his deep domain experience from Temporal to challenge Pydantic AI entering workflow orchestration territory. Samuel clarifies the library scope versus infrastructure, highlighting upcoming distributed state and Cloudflare Pyodide execution. | |
| Multi-Agent Patterns, Swarms, and the Bitter Lesson | 6 | 4 | 4 | 4 | Swyx presents the Bitter Lesson and compound AI systems argument where larger base models wipe out bespoke agent scaffolding. Samuel agrees and dismisses hype about exponential model speedups, arguing agent frameworks simply compensate for model unintelligence. | |
| Model Adapters, API Standardization, and Continuous Integration Testing | 7 | 4 | 4 | 6 | Swyx delivers an informed rant questioning why Pydantic AI builds its own model adapter layer instead of delegating to LiteLLM or Portkey. Samuel pushes back citing type safety requirements, proxying security risks, and industry standardization on OpenAI-compatible schemas. | |
| Mock Testing, LLM Evals, and OpenTelemetry Observability | 5 | 5 | 2 | 2 | Alessio and Samuel discuss mock testing and evals methodology. Samuel highlights the OpenTelemetry semantic conventions for GenAI and points out how Pydantic AI avoids proprietary vendor lock-in unlike LangSmith. | |
| OpenTelemetry Span Latency and Migrating to Apache DataFusion | 6 | 6 | 3 | 3 | Swyx questions why Logfire switched from ClickHouse to Timescale and then to DataFusion. Samuel offers an in-depth breakdown of ClickHouse interval bugs, JSON limitations, and why custom Rust-based DataFusion kernels provide superior query control. | |
| Logfire Market Positioning, Licensing, and Pydantic Run Sandbox | 5 | 4 | 2 | 2 | Swyx and Alessio ask how Logfire differentiates against Datadog and Sentry, as well as licensing choices. Samuel explains the closed-source model for Logfire alongside MIT-licensed Pydantic AI and showcases the Pydantic Run browser sandbox. | |
| Reinventing Notebooks with Marimo and Pydantic AI Roadmap | 5 | 4 | 3 | 2 | The conversation covers plain-text notebooks with Marimo, building in London versus San Francisco, and startup hiring discipline. Samuel defends his strict focus on coding and profitability runway over rapid hiring. |