
Case Study: How Dosu Cut Agent Debugging Time by 90% and Saved $30K a Year With Pydantic Logfire
Dosu builds knowledge infrastructure for agents and people. It captures what a team learns as it works, organizes that knowledge, and hands it back to agents so they answer faster and use fewer tokens. Behind that product sits a fleet of 54 agents that have logged more than 697,000 production runs. A system of that size produces a steady stream of odd behavior, and each oddity needs someone to trace it back to its cause.
This case study looks at how Dosu's engineers handled that problem. They built their agents on Pydantic AI and watched them with Pydantic Logfire. Debugging that once took about an hour now takes minutes, and a set of hidden cost bugs, once found, saved the company more than $30,000 a year. The details show what changes when observability is designed around how agents actually work.
Why Function-Level Tracing Fell Short for Dosu
Why the Existing Tracing Setup Needed to Evolve
Dosu has been building agents for more than three years. When it started, the major agent frameworks were still maturing, and committing to one risked locking the team into an approach that might soon look dated. So the engineers wrote their own framework and traced it with LangSmith, which kept them free to change direction as the field settled. For a long stretch, that approach worked well.
As newer harness engineering practices took hold, the team wanted to rebuild its agents around them. It also wanted to keep control of the parts of its own framework that made Dosu distinct.
Questions About Agents, Tools Built Around Functions
The deeper issue was the level at which the team could see its systems. Their tooling was organized around functions, while their questions were about agents. When a run went wrong, an engineer wanted to know what the agent had been told, what it answered, and where the conversation drifted. Reconstructing that story from a pile of tool calls was slow, and it got slower as runs grew longer.
Some of Dosu's traces stretch past 25 minutes and contain a long chain of tool calls. Over 14 days, the team worked through 193 production traces by hand. That is a lot of engineering time spent reading rather than fixing.
How Dosu Settled on Pydantic AI and Logfire
Observability Across the Agent Stack
Dosu wanted agent instrumentation that fit its existing code and long-running workflows. The team chose Pydantic AI for development, with native Pydantic Logfire instrumentation for tracing. That allowed the engineers to concentrate on following complete agent activity and its supporting services rather than maintaining a separate monitoring integration.
That last point mattered to a team that had spent years avoiding lock-in. Dosu has since marked several of its custom components, including shared state across parallel agents and resumable runs, as candidates to move onto Pydantic AI's built-in capabilities.
Chat History as a Core Object
Turning on Logfire took a single step, because Pydantic AI ships with built-in instrumentation. The more important change was what the team could now see. Logfire treats an agent's conversation as a core object, so engineers read a run's chat history directly instead of piecing it together from tool calls.
Founder and CEO Devin Stein described seeing the chat history as a first-class citizen as a big unlock for the team. That shift removed the translation step that had slowed every investigation. The people debugging a run spent less effort recovering context and more effort acting on it.
Debugging Inside the Coding Agent With the Logfire MCP Server
Plain-Language Questions, Cited Answers
An unplanned benefit of the move was the Logfire MCP server. It exposes trace data to the coding agents that Dosu's engineers already use, so most debugging now happens there rather than in the Logfire interface. An engineer asks about production behavior in plain language and gets cited answers back. Head of OSS Taylor Dolezal said he rarely has to dig into Logfire itself unless the problem is a truly gnarly one.
Triage is where the effect is clearest. The coding agent uses the server to cut a long trace down to the sections that matter, so nobody scrolls through 25 minutes of tool calls looking for the one that failed. Stein put the saving at 90% of debugging time. Time to root cause on an agent issue has dropped from about an hour to a few minutes.
Turning the Worst Runs Into Fixes
The second gain is bigger than faster triage. Dosu queries Logfire for its worst runs, such as a session that lasted 45 minutes or a tool call that took far too long. It then hands those runs to a coding agent, which analyzes them and proposes a fix. The engineer can find the problem, repair it, and ship the change in a single session.
Stein called this use of coding agents and the MCP server to analyze runs, suggest improvements, and implement them really powerful for the team. Observability here is more than a place to look after something breaks. It feeds back into the product.
Fleet-Wide Visibility and the Hidden Cost Bugs
One Dashboard for Every Agent
Dosu runs many agents, and the Logfire agents dashboard shows all of them in one place without extra setup. It lists run counts, cost, average duration, and recent usage for each agent. For a team that previously inspected agents one run at a time, this was a new vantage point.
Stein said the aggregate view was really nice to get out of the box. The surprise was what it surfaced. Problems that hide inside individual runs tend to look normal until you add them up.
Prompt Caching Waste Found in Aggregate
The dashboard exposed several expensive bugs tied to prompt caching, which the team had found very hard to track down before. Per-run inspection would never have caught them, because each run looked acceptable on its own. Taken together, the pattern was clear, and the fixes were straightforward.
Dosu saved more than $30,000 a year by correcting them. Speed matters, but so does seeing waste that no single trace would reveal.
Related Customer Outcomes Across AI Engineering
Dosu is not the only team that has reworked its agent stack around Pydantic. Three other published examples show different benefits, from performance to compliance to monitoring.
MindsDB and Tighter Control Over Agent Behavior
MindsDB builds AI data analysts that let users query databases in natural language. After about two years with its previous agent setup, the team wanted tighter control over agent behavior and the ability to validate outputs at every step. It built a proof of concept on Pydantic AI over a single weekend and tested it on its enterprise product first. Within a month, agent performance had improved tenfold, enough to help close an enterprise deal that had been stalled by performance problems. The move also dropped gigabytes of dependencies, and any backend engineer on the team can now work on the agent code. Internal experiments that used to take weeks now take hours.
Qualio and Evidence for Regulators
Qualio provides quality management software to medical device makers and pharmaceutical companies, whose customers must verify each release before using it. Traditional browser tests could not confirm that an AI assistant found the right document or refused to invent a regulation. After comparing several options, the team chose Pydantic AI for its fast iteration and its simple handling of human approval steps. It then wired Pydantic Evals into its deployment pipeline, with roughly 160 test cases and 300 evaluations running against every prompt, orchestration, or model change. A pass rate below the threshold blocks the release, and Qualio now has evidence to give regulators when they ask how it knows the product works.
Sophos and Full Visibility in Production
Sophos's SecOps AI team builds security tools that protect millions of endpoints, including an AI assistant for customers. Its earlier monitoring showed disconnected fragments, and background jobs failed silently when Celery workers never picked up tasks. After adopting Logfire, the team turned on integrations for libraries it already used, such as FastAPI and httpx, and could see the full conversation thread, the model call, and every API hop in one view. SQL-based monitors now catch missing spans that once went unnoticed for hours. Because the data is sensitive, Sophos runs Logfire on its own infrastructure through the enterprise self-hosting option, and it later added Pydantic Evals to compare prompt changes side by side.
The Numbers Behind Dosu's Results
Faster Answers Without Losing Depth
Debugging time fell by 90%, the path to a root cause shrank from about an hour to a few minutes, and the cost fixes saved more than $30,000 a year. Behind those numbers is a change in how the team works. Most investigations no longer require opening the observability interface at all, since the answers arrive inside the tool where the engineer is already working.
Depth was not lost. Engineers can still dig into a trace when a problem is truly difficult. They do so only when it is worth the effort, rather than as a default for every odd run.
Habits Other Teams Can Copy
Dosu's experience points to a few habits worth copying. Match the tool to the shape of the system, because a trace viewer built for linear function calls will struggle with an agent-first design. Put observability where the work happens, so questions can be asked in plain language. Close the loop by feeding the worst runs back into a coding agent that can propose the fix.
The last habit is the one Dosu's cost bugs illustrate best: aggregate views find what per-run views hide. Dosu is now moving its in-house evaluations onto Pydantic Evals, which integrates with Logfire. That step extends the same idea from spotting problems to measuring quality.
Why Dosu's Story Is Worth Studying
Dosu's results demonstrate the value of visibility across production AI workflows. Logfire brings the agent's conversation, execution spans and costs into an investigation that engineers can act on. Its OpenTelemetry foundation supports compatible instrumentation across frameworks, while evaluation workflows can help convert discovered failures into repeatable tests. The customer chose Pydantic AI for development, but adopting that framework is not required to use Logfire.
|