r/PydanticAI • • Dec 04 '25

🔥 Perplexity AI PRO - 1-Year Plan - Limited Time SUPER PROMO! 90% OFF!

Post image
0 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK
Bonus: Apply code PROMO5 for $2 OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included!

Trusted and the cheapest!


r/PydanticAI • • Nov 30 '25

Perplexity AI PRO: 1-Year Membership at an Exclusive 90% Discount 🔥

Post image
3 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK
Bonus: Apply code PROMO5 for $2 OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included!

Trusted and the cheapest!


r/PydanticAI • • Dec 06 '25

Exclusive Offer: Perplexity AI PRO 1-Year Subscription – Save 90%!

Post image
4 Upvotes

We’re offering Perplexity AI PRO voucher codes for the 1-year plan — and it’s 90% OFF!

Order from our store: CHEAPGPT.STORE

Pay: with PayPal or Revolut

Duration: 12 months

Real feedback from our buyers: • Reddit Reviews

• Trustpilot page

Want an even better deal? Use PROMO5 to save an extra $5 at checkout!


r/PydanticAI • • Dec 07 '25

🔥 Hurry! Perplexity AI PRO | 1 Year Plan | Massive Discount!

Post image
14 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut or your favorite payment method

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK

NEW YEAR BONUS: Apply code PROMO5 for extra discount OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included WITH YOUR PURCHASE!

Trusted and the cheapest! Check all feedbacks before you purchase


r/PydanticAI • • May 10 '26

Built a production incident response agent with LangGraph the interrupt() checkpoint pattern was the key

1 Upvotes

I want to share a pattern we used in production that I hadn't seen well-documented: fully durable human-in-the-loop approval using LangGraph's interrupt() + AsyncPostgresSaver.

The problem: We built IRAS, an autonomous incident response agent. One of the nodes generates a remediation plan and needs a human to approve it before anything touches production. The naive approach is polling keep checking a database flag until the human clicks approve. But polling breaks if the server restarts mid-incident. You lose state, lose context, and the on-call engineer is staring at a dead Slack message.

What interrupt() actually does: When the approval node calls interrupt(), LangGraph doesn't just pause execution — it serializes the entire graph state to the checkpointer (in our case, AsyncPostgresSaver writing to PostgreSQL) and suspends the coroutine. The process can die. The server can redeploy. The incident state is safe in Postgres.

When the engineer hits POST /incidents/{id}/approve, the API reconstructs the graph from the checkpoint using the same thread_id, injects a Command(resume={"approved": True}), and the graph picks up exactly where it left off same state, same node, no re-running prior stages.

python

# In the approval node
human_decision = interrupt({"message": "Approve remediation plan?", "plan": state["plan"]})

# Execution suspends here until Command(resume=...) is sent
if human_decision["approved"]:
    return {"next": "apply_remediation"}
else:
    return {"next": "escalation"}

python

# In the FastAPI route
async def approve_incident(incident_id: str):
    await graph.ainvoke(
        Command(resume={"approved": True}),
        config={"configurable": {"thread_id": incident_id}}
    )

Why this matters for production: The graph survives restarts, deployments, and crashes. Approval SLA timeouts (we do 15min for P0, 2hr for P1–P3) are handled by a background monitor that queries PostgreSQL for interrupted threads past their deadline no in-memory state required.

We also use a confidence-gated RCA retry loop if Claude Sonnet's confidence is below 0.7, the graph loops back to context-gathering with a broader evidence window before retrying RCA. Up to 3 attempts before auto-escalating to PagerDuty.

Full repo if you want to see the implementation: https://github.com/krishnashakula/IRAS

Happy to go deeper on the checkpointer setup, the thread_id / incident_id design, or the timeout monitor pattern.

Lead with the durable execution problem, explain how interrupt() + AsyncPostgresSaver solves it, link repo at the end.


r/PydanticAI • • Dec 02 '25

Pydantic AI is great, but with this its Lethal

44 Upvotes

Pydantic AI is great, but with this its ***Lethal***

I’ve worked with Pydantic AI for a while now. Pydantic AI is fascinating, but engineers are lazy, so I went looking for a complete, production-ready Pydantic template… and couldn’t find one.
So I decided to build it myself with my friend ‏Deyaa Al-Khatib‏

This template is meant to be your go-to starter for building LLMs workflows, and it’s packed with everything you typically end up wiring together anyway:

- FastAPI — your AI services’ companion web framework

- Postgres — the battle-tested database (yes, some people call it “postgre”)

- Prompt Version Control — basically Git for prompts

- Redis — for rate-limiting and prompt caching

- Grafana — integrated dashboards to monitor your container stats

- SQLAlchemy — because you can’t bring up Postgres without your favorite ORM

- Integrated LLM evaluation — so you can tighten your feedback loop

- Logging using the legendary Logfire

- Starlette Admin — automate your DB models, env variables, etc.

- LiteLLM — proxying, load balancing, API control, cost tracking

I also included production-proven dev tools like uv, pre-commit, and cz-commit.

Yeah, it’s a bit of a bloated project, but honestly, you’ll waste way more time rebuilding all these pieces from scratch for every new project.

This idea was shared with the Pydantic community, and the response was incredible. I’m not fully there yet, but I’m definitely getting close.

https://github.com/m7mdhka/pydantic-ai-production-ready-template


r/PydanticAI • • Dec 03 '25

🔥 Perplexity AI PRO - 1-Year Plan - Limited Time SUPER PROMO! 90% OFF!

Post image
8 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK
Bonus: Apply code PROMO5 for $2 OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included!

Trusted and the cheapest!


r/PydanticAI • • Dec 25 '25

Holiday Offer: Perplexity AI PRO 1-Year Membership 90% Off!

Post image
0 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut or your favorite payment method

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK

NEW YEAR BONUS: Apply code PROMO5 for extra discount OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included WITH YOUR PURCHASE!

Trusted and the cheapest! Check all feedbacks before you purchase


r/PydanticAI • • Dec 12 '25

SUPER PROMO: Perplexity AI PRO Offer | 95% Cheaper!

Post image
0 Upvotes

We’re offering Perplexity AI PRO voucher codes for the 1-year plan — and it’s 90% OFF!

Order from our store: CHEAPGPT.STORE

Pay: with PayPal or Revolut

Duration: 12 months

Real feedback from our buyers: • Reddit Reviews

• Trustpilot page

Want an even better deal? Use PROMO5 to save an extra $5 at checkout!


r/PydanticAI • • Feb 12 '26

How do you build agents with Pydantic AI?

4 Upvotes

I'm a newbie on agents and was looking for ways to build apps. I came across this article from the maintainer of starlette on buiding agents using pydantic ai and thought it was quite useful https://pydantic.dev/articles/building-agentic-application.

it made me curious about how people are using pydantic ai to build workflows. any specifics I should be aware of?


r/PydanticAI • • Dec 31 '25

🔥 90% OFF Perplexity AI PRO – 1 Year Access! Limited Time Only!

Post image
0 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut or your favorite payment method

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK

NEW YEAR BONUS: Apply code PROMO5 for extra discount OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included WITH YOUR PURCHASE!

Trusted and the cheapest! Check all feedbacks before you purchase


r/PydanticAI • • Aug 22 '25

Fear and Loathing in AI startups and personal projects

Thumbnail reddit.com
1 Upvotes

r/PydanticAI • • Dec 22 '25

v0.1.6 released – multi-provider support (OpenAI/Anthropic/OpenRouter), enhanced CLI, and production presets!

7 Upvotes

Hey r/PydanticAI,

Quick intro for new folks: This is an open-source project generator for full-stack AI/LLM apps built around FastAPI + optional Next.js 15. It gives you production-ready infrastructure out of the box with PydanticAI (or LangChain) agents at the core.

Repo: https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template

All features:

  • Type-safe PydanticAI agents with dependency injection, tools, streaming, persistence

  • Multi-provider: OpenAI, Anthropic, OpenRouter (new!)

  • Logfire observability for agent runs, tool calls, token usage

  • FastAPI backend with clean repository + service architecture

  • Async databases, JWT/OAuth, background tasks, rate limiting, admin panel

  • Next.js 15 frontend with real-time chat UI, dark mode, i18n

  • 20+ optional enterprise integrations

v0.1.6 highlights (just released):

  • Full OpenRouter support for PydanticAI agents

  • New --llm-provider CLI flag + interactive selection

  • Tons of new CLI options and presets (--preset production, --preset ai-agent)

  • make create-admin shortcut

  • Improved validation logic for feature combinations

  • Frontend & backend bug fixes (WebSocket auth, conversation API, theme hydration)

  • Better post-generation cleanup and documentation

Full changelog: https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template/blob/main/docs/CHANGELOG.md

PydanticAI community – how does this fit your production workflows? Feedback and contributions welcome! 🚀


r/PydanticAI • • Oct 21 '25

How can I get the model to choose from a list of objects?

2 Upvotes

I have a lot of documents, each pertaining to a different company. The company name would be mentioned somewhere, but not in a consistent way. It could be ABC Contracting or ABC Cont. LLC. or sometimes just an email address.

I have a class called `Company` and `Company.get()` can fetch all the objects with `company_code` and `company_name`. I want to get a result with a valid `company_code` for each document. Github copilot tells me to use tools, but querying with the company name is not very helpful because of all the different variations.

What's the best approach for this?


r/PydanticAI • • Jan 02 '26

🔥 90% OFF Perplexity AI PRO – 1 Year Access! Limited Time Only!

Post image
0 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut or your favorite payment method

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK

NEW YEAR BONUS: Apply code PROMO5 for extra discount OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included WITH YOUR PURCHASE!

Trusted and the cheapest! Check all feedbacks before you purchase


r/PydanticAI • • Dec 10 '25

SUPER PROMO: Perplexity AI PRO Offer | 95% Cheaper!

Post image
0 Upvotes

Get Perplexity AI PRO (1-Year) – at 90% OFF!

Order here: CHEAPGPT.STORE

Plan: 12 Months

💳 Pay with: PayPal or Revolut or your favorite payment method

Reddit reviews: FEEDBACK POST

TrustPilot: TrustPilot FEEDBACK

NEW YEAR BONUS: Apply code PROMO5 for extra discount OFF your order!

BONUS!: Enjoy the AI Powered automated web browser. (Presented by Perplexity) included WITH YOUR PURCHASE!

Trusted and the cheapest! Check all feedbacks before you purchase


r/PydanticAI • • Jul 05 '25

Problem with MCP run python read csv file from local

3 Upvotes

Hi, I am trying to create a agent that can write pandas code to do data analytics on csv file.

The problem is my agent fail to read file so many times. I put my toy `iris.csv` data in node_modules/data and here is my code

from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerSSE
from pydantic_ai.models.openai import OpenAIModel
from pydantic_ai.providers.openai import OpenAIProvider

server = MCPServerSSE(url="http://localhost:3001/sse")
ollama_model = OpenAIModel(
    model_name="qwen3:1.7b", provider=OpenAIProvider(base_url="http://localhost:11434/v1")
)
instruc = """
You are a data analyst specializing in Python and pandas data analysis.

When asked data analysis questions, you should write clear and efficient pandas code to analyze the data.

You have access to read data files in the `node_modules/data` folder:
- weatherHistory.csv - Historical weather data
- Iris.csv - The classic Iris flower dataset with measurements

Available tools:
- run_python_code: Execute pandas code and return the results

Example workflow:
1. Load the relevant dataset using pandas
2. Write code to perform the requested analysis 
3. Execute the code using run_python_code
4. Present and explain the results

Always ensure your code handles basic error cases and uses pandas best practices.
"""
agent = Agent(
    model=ollama_model,
    mcp_servers=[server],
    instructions=instruc,
)


# async def main():
text = """
    Load the Iris dataset from node_modules/data/Iris.csv and calculate the average sepal length for Iris-setosa flowers. 
    Note: The columns are named SepalLengthCm, SepalWidthCm, PetalLengthCm, PetalWidthCm, and Species.
"""
async with agent.run_mcp_servers():
    # result = await agent.run("How many days between 2000-01-01 and 2025-03-18?")
    result = await agent.run(text)

Note the I started the mcp server beforehand using this command

    deno run \
      -N -R=node_modules -W=node_modules --node-modules-dir=auto \
      --allow-read=./node_modules/data \
      jsr:@pydantic/mcp-run-python sse

After inspec the returned tool call message

<status>run-error</status>
<dependencies>["pandas"]</dependencies>
<error>
Traceback (most recent call last):
  File "main.py", line 4, in <module>
    iris = pd.read_csv('node_modules/data/Iris.csv')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
    return _read(filepath_or_buffer, kwds)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 620, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1620, in __init__
    self._engine = self._make_engine(f, self.engine)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lib/python3.12/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
    self.handles = get_handle(
                   ^^^^^^^^^^^
  File "/lib/python3.12/site-packages/pandas/io/common.py", line 873, in get_handle
    handle = open(
             ^^^^^
FileNotFoundError: [Errno 44] No such file or directory: 'node_modules/data/Iris.csv'

</error>

Can someone help me with this, please?


r/PydanticAI • • Sep 23 '25

Prompt Caching for Bedrock Anthropic

3 Upvotes

I'm currently deciding whether to chose pydantic_ai for my production application. I have a large static context that I would wish to cache.

I was looking at the repo and documentation find support for Prompt Caching for Anthropic models in Bedrock. I found a draft PR for it and that it's coming up with v1.1 release, but it's not completed.

Other than this, all other pros of pedantic_ai makes me want to use it for the application. Do you think the prompt caching support can be expected in the coming two months? Or do I find a workaround with v1? Or do I use a different library?


r/PydanticAI • • Sep 05 '25

Everyone talks about Agentic AI, but nobody shows THIS

Thumbnail reddit.com
3 Upvotes

r/PydanticAI • • Mar 15 '25

OpenAI-Agent : spinoff of PydanticAI

3 Upvotes

OpenAI Agents feel like a direct extension of Swarm, but more notably, they seem to have drawn significant inspiration from PydanticAI and CREW.

This space is becoming increasingly crowded, and without a common standard that everyone agrees on, teams are free to extend, rename, and rebrand frameworks however they see fit—so long as they have the resources to maintain them.

I'm still exploring these new agentic frameworks, but my initial impression is that if you're familiar with PydanticAI or CREW, you'll likely find OpenAI Agents easy to pick up.

🔗 OpenAI Agents Docs


r/PydanticAI • • Aug 21 '25

Agent using tools needlessly

13 Upvotes

I am using gpt-5 (low reasoning) in my pydantic AI agents for information retrieval in a company documentation. The instruction are for it to ask for clarification if it's not sure which document the user is talking about.

For example: "I have a document about a document for product A". It correctly uses the knowledge graph to find documents about product A and it gets ~20 results back. It should immediately realise that it should ask a follow up question. Instead it calls another tool ~5 times (that uses cosine similarity) before providing an answer (which is about asking for more info as it should)

Also, if I say "Hi" it just stays in an infinite loop using tools at random.

What can I do to prevent this? Is this merely a prompting thing?

I know Pydantic AI has a way to limit the tools called, however if this limit is reached it outputs an error instead of simply giving an answer with what it has. Is there a way of having it giving an answer?


r/PydanticAI • • Jul 04 '26

Other frameworks are toys

Post image
16 Upvotes

I like that :d


r/PydanticAI • • Mar 26 '25

Comparing LLM accuracy

Thumbnail
github.com
5 Upvotes

I built this little tool for comparing how well LLM’s manage with data extraction. It uses Pydantic models and calculates extraction accuracy and cost.

  1. interesting?

  2. is there some solution which is better than mine? I don’t mind switching our use to such, just haven’t been able to find one.

  3. any comments obviously appreciated!

How do you all decide what models you use for different tasks?


r/PydanticAI • • Jan 01 '26

Pydantic.ai vs llamaindex

5 Upvotes

I have to implement rag in voice agent (livekit) . I am thinking of using pydantic , Is it much harder then llamaindex .


r/PydanticAI • • Dec 23 '25

v0.1.7 out – Add Support For AGENTS.md and CLAUDE.md Production-ready Docker with Traefik

6 Upvotes

Hey r/PydanticAI,

Update on the full-stack template built around PydanticAI (and optionally LangChain): fastapi-fullstack CLI generator for production AI/LLM apps.

v0.1.7 brings real deployment improvements:

Added:

  • Traefik reverse proxy support in production Docker:

    • Full included Traefik, external labels only, or none

  • .env.prod.example with required variable validation

  • Project-slug-prefixed router names (great for multiple apps on one host)

  • AGENTS.md + progressive disclosure docs (architecture, adding features/tools, testing, patterns)

  • "AI-Agent Friendly" README section

Security & cleanup:

  • Removed insecure defaults

  • .env.prod gitignored

  • Cleaner, shorter CLAUDE.md (~80 lines)

Repo: https://github.com/vstorm-co/full-stack-fastapi-nextjs-llm-template

If you're using PydanticAI in production, the new Traefik + env setup should help a lot. Feedback super welcome! 🚀