Catching a 20× Cost Spike Before It Hit the Budget: An Overjoy Case Study on Pydantic Logfire

Most engineering teams find out about a runaway AI cost the same way: a bill arrives, and nobody can say which feature caused it. Overjoy, a B2B SaaS company, avoided that moment. One of its agents began silently repeating the same call at roughly twenty times its normal usage, and the team saw the pattern before it ate into the budget.

This article looks at how that happened, what the team had to change to see it, and what the story says about Pydantic's tooling. We also look at three other teams that use the same stack for very different reasons. The details come from the published customer stories on the Pydantic website, with Overjoy as the main subject.

Meet the Team Behind the Numbers

A Five-Engineer Company Building a CRM for Consumer Brands

Overjoy makes an AI-powered customer relationship tool for consumer packaged goods brands. Its product covers finding leads, writing personalized outreach, tracking product samples, and predicting when a retailer will reorder. Each of those jobs leans on language models, which means every feature carries both a quality question and a cost question.

The engineering group is small. Five engineers run the whole stack, and only a few of them work on AI features directly. Founding engineer Ishaan Nagpal describes a setup where tool choices decide what the team can realistically ship, because there is no spare capacity to absorb a clumsy framework or a tool that needs constant care.

Pydantic Logfire gives Overjoy a shared view of agent behavior, token usage and costs across its chat interfaces, background jobs and enrichment pipelines. The team also uses Pydantic AI to build agents and Pydantic Evals to measure their quality.

Why Pydantic Was the Natural Pick

For a small engineering team, the decisive benefit was being able to gain production visibility without dedicating substantial time to maintaining instrumentation. The switch gave Overjoy clearer evidence of how much its AI workflows cost and where they were failing.

Overjoy's experience illustrates why monitoring needs to keep pace with application development. A shared view of instrumented model calls, background jobs and supporting services makes it easier for a small team to understand costs and investigate failures as its workflows evolve.

The company had started with LangChain for agents and LangSmith for tracing. With several SDKs in play, nobody had one view of token usage or costs, and the team wanted a setup that took less effort to configure. After the switch to Pydantic AI and Logfire, Nagpal had tracing running on the same day he built his first agent, a detail that matters when the person doing the work is also the person running everything else.

Where Debugging Used to Break Down

A Stack Held Together by Manual Effort

Before the change, Overjoy used several tools that each saw only part of the picture. Sentry reported errors, but it could not explain what an agent had been doing when something failed. Cost and token usage were scattered across multiple software development kits, so nobody had a single view of spending.

When a production problem appeared, the team pieced the story together by hand from Cloud SQL logs, Sentry, PostHog, and Postgres timestamps.

Half a Day Per Issue, and One Person to Solve It

A non-trivial bug could take half a day or longer to resolve. Worse, the work usually landed on Nagpal or the CTO, since they were the only people holding enough context to connect the clues.

That kind of bottleneck is easy to overlook on a small team because it looks like normal busyness. It matters most for AI features, where an agent can misbehave quietly, and where the cost of not noticing grows with every request.

Overjoy had adopted Logfire before it began any AI tracing. Its first goal was ordinary visibility into where a request goes and what fires when a job fans out.

How Logfire Changed Daily Work

One Dashboard Instead of Four Tools

Logfire put API performance, background job queues, worker logs, model call traces, and agent activity into a single place. For a team that previously stitched together four or five sources, the change was less about new data and more about having the existing data connected. Nagpal also found it useful for latency, traffic, and database connection problems, because traces held together across deployment versions.

The effect on who can fix things stood out. Engineers who are not yet fully onboarded on the backend can investigate customer issues using the Logfire MCP server, and most problems are now triaged in minutes instead of hours. Work that depended on one person's memory became something the whole group can do.

Letting a Coding Agent Read the Traces

The biggest shift came when Overjoy connected the Logfire MCP server to Cursor, giving an AI coding agent direct SQL access to span data. Observability stopped being something a person reads on a screen and became working material that an agent can query on its own.

One episode shows how this plays out. A critical sales demo agent had to move off a deprecated model, and the replacement followed instructions so literally that the demo outputs lost their variety. Nagpal was in a car heading to the airport when the problem surfaced.

From his phone, he started a Cursor cloud agent wired to Logfire. It compared that day's agent calls against the previous week, ran parallel experiments using real data pulled from traces, and settled on a fix that combined two models with new prompting and some static heuristics. Thirty-five minutes later, the fix was merged and live.

The same loop now runs across several features. A Slack mention or a Sentry error can trigger an automated triage that pulls the relevant Logfire context without anyone asking. Pydantic Evals adds a final step, since production traces serve as the test material for checking whether a change really improved output quality. Nagpal has let an agent run up to ten autonomous rounds to hit a quality target after labeling about a hundred rows himself.

Anatomy of the 20× Cost Spike

A Quiet Bug That Repeated the Same Call

The incident at the center of this study was not dramatic. One agent began repeating an identical call over and over, and its usage climbed to around twenty times normal. Nothing crashed, no alarm sounded, and the feature kept working, so ordinary error monitoring had nothing to report.

That is the awkward feature of agent costs. A loop that wastes money looks healthy from the outside because every response still arrives.

What Cost Visibility Made Possible

With Logfire showing usage per agent, the jump stood out as an anomaly rather than a line item on next month's invoice. The team found the cause and fixed it before it consumed a meaningful part of the budget. According to the case study, without that cost visibility the team would have burned through its budget before noticing.

Nobody had to build a custom billing dashboard to catch it. Cost and traces lived in the same view the engineers already used to debug, so the spike surfaced as part of regular work.

Three Mini Case Studies from Other Teams

Dosu: Seeing the Whole Conversation

Dosu had been tracing agents with LangSmith around an in-house framework. Its rebuild brought native Pydantic Logfire instrumentation into the agent stack, providing engineers with a trace of the agent's execution and readable conversation context. The case illustrates why visibility across a complete agent run matters more than tracing isolated functions.

The team now does most debugging from inside a coding agent through the Logfire MCP server. Some runs last more than 25 minutes, and the company reports that this approach cut debugging time by 90 percent. Root-cause time on agent issues fell from about an hour to a few minutes, and an aggregate dashboard exposed prompt-caching cost bugs, saving over $30,000 a year.

Qualio: Proof for Customers Who Audit Everything

Qualio serves life sciences customers who must certify each release. Its long-standing browser-based tests could confirm that an AI assistant rendered, but not whether it cited the right document or invented a rule. Product architect Níall Ó Beaglaoich compared Bedrock Agents, AG2, Strands Agents, LangGraph, and Pydantic AI. Pydantic AI won on iteration speed and on how simply it handled steps where a person must approve an action before the agent continues.

Pydantic Evals now sits inside Qualio's deploy pipeline, with roughly 160 test cases and 300 evaluations running on every prompt, orchestration, or model change. A pass rate below the team's threshold blocks the release. When the team merged its multi-agent design into one agent with two high-level tools instead of ten, those evaluations confirmed the new version still handled every earlier scenario.

Justice AI Unit: Contracts at Every Handoff

The Justice AI Unit at the UK Ministry of Justice builds tools that help judges and probation staff work with documents and recordings. Its work illustrates the need for reliable, inspectable AI workflows in sensitive environments, where plausible output is not enough to establish a trustworthy result.

In its transcription tool, structured model responses are validated before they reach calling code, and a shared wrapper handles parsing and a limited number of retries. A developer adding a new task gets either a valid model or an error, with no third outcome. In its tool for judges, citations stay linked to the evidence, and the models record separately whether a quotation was found in the source and whether it supports the claim.

Practical Lessons for Lean Engineering Teams

Consolidate Before You Scale

The Overjoy story suggests that scattered monitoring gets more expensive as a product grows. Each new feature adds another place to look, and the knowledge needed to connect them stays in a few heads. A single platform that covers general tracing, AI observability, and evaluation takes effort to set up, but the effort is paid back once problems show up in more than one place.

Treat Traces as Working Material

The second lesson is that observability data is most valuable when something acts on it. Overjoy, Dosu, and Qualio each use their records as input to decisions, whether that means a coding agent proposing a fix, an engineer asking a plain-language question, or a pipeline refusing to ship a weak release.

This changes who benefits from the data. Instead of a dashboard that one specialist checks, the information becomes something every engineer can use, and the next problem gets handled faster than the last one.

A Small Alert That Protected a Real Budget

Overjoy's 20× spike illustrates the value of monitoring model spend and execution in production. Pydantic Logfire brings AI and LLM observability, OpenTelemetry and evaluations together with application telemetry, enabling teams to connect cost changes and failures to the operations responsible. The outcomes described here are self-reported by the companies; teams should assess them against their own workloads. The practical lesson is that visibility into AI systems can help identify problems before they appear on an invoice.

Privacy Policy