---
title: "#pydantic articles | Hashnode"
description: "Explore 70 articles tagged #pydantic on Hashnode. Tutorials, guides, and how-tos from the community."
url: "https://hashnode.com/tag/pydantic"
---

Tag

# #pydantic

70 posts · 12 followers

[Waqas Shahid](https://hashnode.com/@practicaldevblog) · [2d ago](https://hashnode.com/posts/pydantic-catch-bad-data-before-it-reaches-your-database/6af155c601735a92c4b00807)

### [Pydantic: Catch Bad Data Before It Reaches Your Database](https://practicaldevblog.hashnode.dev/pydantic-catch-bad-data-before-it-reaches-your-database?utm_source=hashnode&utm_medium=feed)

A library lets members borrow books through a web form. One day, a member types -5 into the loan period field, another mistypes her email, and a third pastes an ISBN with a letter in it. The form save

7 min read · [practicaldevblog.hashnode.dev](https://practicaldevblog.hashnode.dev/pydantic-catch-bad-data-before-it-reaches-your-database?utm_source=hashnode&utm_medium=feed)

[MemorySync](https://hashnode.com/@memorysync) · [4d ago](https://hashnode.com/posts/pydantic-ai-bedrock-mantle-azure-tool-call-id-64-characters/6aef4fe4880f71c106451a1c)

### [Pydantic AI: Bedrock Mantle tool-call IDs over 64 characters break replay to Azure](https://memorysync.hashnode.dev/pydantic-ai-bedrock-mantle-azure-tool-call-id-64-characters?utm_source=hashnode&utm_medium=feed)

Mantle history stores <response\_id>:<call\_id>. Fit the IDs on the outgoing Azure copy with a profile override until a fix lands.

7 min read · [memorysync.hashnode.dev](https://memorysync.hashnode.dev/pydantic-ai-bedrock-mantle-azure-tool-call-id-64-characters?utm_source=hashnode&utm_medium=feed)

[MemorySync](https://hashnode.com/@memorysync) · [4d ago](https://hashnode.com/posts/langgraph-rootmodel-checkpoint-list-object-has-no-attribute-root/6aef4ed0a1f756ec0cb0a3d5)

### [LangGraph: "'list' object has no attribute 'root'" after resume with a Pydantic RootModel in state](https://memorysync.hashnode.dev/langgraph-rootmodel-checkpoint-list-object-has-no-attribute-root?utm_source=hashnode&utm_medium=feed)

JsonPlusSerializer turns a RootModel into its raw value on checkpoint load. Wrap it in a BaseModel or store plain values.

5 min read · [memorysync.hashnode.dev](https://memorysync.hashnode.dev/langgraph-rootmodel-checkpoint-list-object-has-no-attribute-root?utm_source=hashnode&utm_medium=feed)

[MemorySync](https://hashnode.com/@memorysync) · [4d ago](https://hashnode.com/posts/pydantic-ai-summarizing-compaction-keep-user-messages-drops-messages/6aef4df5dd4ac1fbf8951837)

### [Pydantic AI SummarizingCompaction(keep\_user\_messages=True) drops recent messages](https://memorysync.hashnode.dev/pydantic-ai-summarizing-compaction-keep-user-messages-drops-messages?utm_source=hashnode&utm_medium=feed)

Messages trimmed for retained user turns skip the summary. Turn the flag off, use keep\_tokens, or keep the full transcript.

6 min read · [memorysync.hashnode.dev](https://memorysync.hashnode.dev/pydantic-ai-summarizing-compaction-keep-user-messages-drops-messages?utm_source=hashnode&utm_medium=feed)

[MemorySync](https://hashnode.com/@memorysync) · [5d ago](https://hashnode.com/posts/pydantic-ai-anthropic-container-identifier-code-execution-400/6aee024c4386290813dcf000)

### [Pydantic AI + Anthropic: "Container identifier can only be provided when using the code execution tool" (400)](https://memorysync.hashnode.dev/pydantic-ai-anthropic-container-identifier-code-execution-400?utm_source=hashnode&utm_medium=feed)

A follow-up run used to reuse the code execution container from message history on requests without code execution. Upgrade to 2.65.0+, or on older releases set anthropic\_container=False / strip the id.

8 min read · [memorysync.hashnode.dev](https://memorysync.hashnode.dev/pydantic-ai-anthropic-container-identifier-code-execution-400?utm_source=hashnode&utm_medium=feed)

[MemorySync](https://hashnode.com/@memorysync) · [5d ago](https://hashnode.com/posts/pydantic-ai-no-tool-output-found-for-function-call/6aee01e123fdaaaa691cf62d)

### [Pydantic AI: fixing 'No tool output found for function call' after an aborted run or trimmed history](https://memorysync.hashnode.dev/pydantic-ai-no-tool-output-found-for-function-call?utm_source=hashnode&utm_medium=feed)

A tool call with no result in your stored message history makes the next request fail. Pydantic AI 2.10.0 and later repair most of these on their own; here's what still raises, a helper for 1.x and older 2.x, and a trim that keeps tool calls with their results.

16 min read · [memorysync.hashnode.dev](https://memorysync.hashnode.dev/pydantic-ai-no-tool-output-found-for-function-call?utm_source=hashnode&utm_medium=feed)

[MemorySync](https://hashnode.com/@memorysync) · [Oct 24](https://hashnode.com/posts/pydantic-ai-agent-memory-across-runs/6adcd790b506b2651483a752)

### [Add long-term memory to a Pydantic AI agent (one capability, per-user recall across runs)](https://memorysync.hashnode.dev/pydantic-ai-agent-memory-across-runs?utm_source=hashnode&utm_medium=feed)

message\_history only carries one conversation. Here's how to give a Pydantic AI 2.x agent per-user memory across runs and threads with one capability, plus five memory tools and typed search.

7 min read · [memorysync.hashnode.dev](https://memorysync.hashnode.dev/pydantic-ai-agent-memory-across-runs?utm_source=hashnode&utm_medium=feed)

[lucky wang](https://hashnode.com/@apigoto-builder) · [Oct 24](https://hashnode.com/posts/reliable-json-from-any-openai-compatible-model-json-schema-then-json-object-then-prompt-only-validated-with-pydantic/6adc69a4a6d3c5bbf619355f)

### [Reliable JSON from any OpenAI-compatible model: json\_schema, then json\_object, then prompt-only, validated with Pydantic](https://apigoto-notes.hashnode.dev/reliable-json-from-any-openai-compatible-model-json-schema-then-json-object-then-prompt-only-validated-with-pydantic?utm_source=hashnode&utm_medium=feed)

One function that degrades gracefully when a model doesn't support structured outputs, and repairs invalid replies by showing the model its own validation errors.

6 min read · [apigoto-notes.hashnode.dev](https://apigoto-notes.hashnode.dev/reliable-json-from-any-openai-compatible-model-json-schema-then-json-object-then-prompt-only-validated-with-pydantic?utm_source=hashnode&utm_medium=feed)

[Jay Mehta](https://hashnode.com/@jay87mehta) · [Aug 13](https://hashnode.com/posts/building-agents-with-pydantic-ai/6a7e49f74e7ef3bb34dc60ba)

### [How to Build Production-Grade Agents with Pydantic AI](https://freecodecamp.org/news/building-agents-with-pydantic-ai?utm_source=hashnode&utm_medium=feed)

Building AI agents with raw LLM SDKs works fine for prototypes until you need structured outputs, testable code, and production reliability. The gap shows up in a predictable way. Your notebook code w

26 min read · [freecodecamp.org](https://freecodecamp.org/news/building-agents-with-pydantic-ai?utm_source=hashnode&utm_medium=feed)

[Akash Hadagali Persetti](https://hashnode.com/@akashpersetti) · [Aug 4](https://hashnode.com/posts/the-eval-schema-i-stopped-migrating/6a724322a44c6a91cba2f25d)

### [The eval schema I stopped migrating](https://akashpersetti.hashnode.dev/the-eval-schema-i-stopped-migrating?utm_source=hashnode&utm_medium=feed)

How EvalBench stores three different LLM eval suites in one MetricRecord with an open metrics dict, so adding a benchmark is a three-file change.

6 min read · [akashpersetti.hashnode.dev](https://akashpersetti.hashnode.dev/the-eval-schema-i-stopped-migrating?utm_source=hashnode&utm_medium=feed)
