How GuruSup's agents write their own code with Pydantic AI and Pydantic Monty
GuruSup is a Valencia-based startup founded by Víctor Mollá, with Fran Pastor as CTO. It began as a platform for automating customer support with AI agents and has built on Pydantic AI since January 2025. Today, its support platform handles 15 million customer messages a year. Building on that experience, GuruSup has expanded into an AI operating system for company work. Its Brain layer centralizes company knowledge and shared skills, exposing them through MCP to an agent harness built on Pydantic AI. With Pydantic AI Harness code mode and Monty, agents can write Python to combine tools and filter results as they carry out assignments.

The challenge: the goal is clear, the path is not
GuruSup's customer support agents could already look up records, run configured actions, hand off conversations, and pause for approval. Pydantic AI handled the agent loop, while GuruSup turned each customer's configured actions into tools.
As GuruSup expanded into broader company work, the team wanted agents to handle assignments whose steps depend on what they find. Reviewing a support queue, for example, can require searching records, following pagination, combining results, and deciding which accounts need attention. Writing a dedicated operation for every variation would mean adding application code each time the request changed.
These assignments required more than tool access. Agents needed company knowledge and shared processes, enough context to work through longer tasks, and a way to involve a person when a decision required approval.
Why Pydantic AI
After testing several agent frameworks, GuruSup adopted Pydantic AI in January 2025. Typing, structured outputs, and the developer experience drove the initial choice.
What has kept the team building on it is a shared view of how agents should work. GuruSup wants agents to construct a procedure around the task and the information they find, while the application controls permissions, approvals, and execution limits. Pydantic's investment in code mode and Monty fits that approach, giving agents a way to express those procedures as code.
Pydantic AI v2's capability model also fits how GuruSup builds its harness. The team can compose features from Pydantic AI Harness, customize their behavior, and add its own capabilities through the same extension points. This reduces the surrounding execution logic GuruSup needs to build and maintain, while keeping control over how agents use company knowledge, discover MCP tools, and act on connected applications.
What keeps the team using Pydantic's tools:
- One framework as the product evolves. Pydantic AI supports both customer support agents and the harness for broader company work.
- Composable capabilities. GuruSup combines Pydantic's capabilities with its own extensions for agent communication, tool discovery, and platform controls.
- Observability that feeds improvement. Pydantic Logfire connects agent traces with the team's debugging, monitoring, and evaluation workflows.
- Durable execution. Pydantic AI's Temporal integration preserves progress across long assignments, human decisions, failures, and worker restarts.
- Code mode and sandboxes. Code mode runs tool coordination in Monty, while sandbox workspaces provide files and a shell.
- New models and capabilities. Pydantic AI lets the team try new models and tools within the framework it already uses.
"The developer experience is completely different with Pydantic AI."
Fran Pastor, CTO, GuruSup
Code mode and more
GuruSup's Brain layer centralizes company knowledge and shared skills and exposes them through MCP. Its agent harness connects that knowledge with tools from external applications. Pydantic AI Harness code mode lets the model write a Python program that calls those exposed tools as functions, while Monty executes it in an isolated sandbox.
A single program can coordinate multiple calls to Brain's MCP and connected services, run independent requests in parallel, and use one tool's output as input to the next. Pagination, calculations, and intermediate processing can happen within that program, reducing the number of round trips to the model. External API calls still execute, but the model can receive selected findings instead of reading every intermediate response.
For example, to identify customer commitments at risk, an agent could query Brain for delivery promises recorded in meeting notes and shared documents, then retrieve related support tickets and engineering issues through connected MCP tools. The generated Python could coordinate those requests, follow paginated results, match records by customer and project, and compare promised dates with current status. It could return unresolved commitments and their supporting evidence for the model to assess and explain. If the assignment also calls for a report, a separate investigation, or approval before sharing it, the rest of the harness carries that work forward.
Beyond code mode, GuruSup uses Pydantic AI Harness capabilities to compact older context, preserve large tool results, and retrieve earlier conversation details. Sandbox workspaces provide files and a shell, while GuruSup's own capabilities let agents delegate subtasks to separate conversations. Together with Temporal, these capabilities let an assignment continue across human decisions and interruptions.

"With code mode running in Monty, our agents combine MCP tools with less context, fewer model round trips, and more flexibility."
Fran Pastor, CTO, GuruSup
Monty limits generated code to the host functions GuruSup exposes. GuruSup configures memory and tool-call limits, while those functions enforce permissions and approval requirements.
Logfire and its MCP server
To understand how those assignments unfold, GuruSup uses Logfire to trace agent runs, inspect model requests and tool calls, and evaluate changes. Through Logfire's MCP server, the whole team, including engineering, customer success, and product, can use agents to investigate platform behavior. They can follow an execution to understand which tools were called, what data they returned, and why an answer was incomplete or an action failed.
GuruSup's own agent harness also uses that access to monitor the platform, investigate failures, notify the team, and automatically create issues with a diagnosis and supporting evidence. Those findings guide changes to instructions, tools, and harness behavior, which the team can evaluate against the original task, closing the loop between monitoring and improvement.
What changed for the team
The broader harness has changed where GuruSup's team spends its engineering effort.
"We spend less time spelling out every step and more time deciding what the agent needs to know, what it can do, and where it needs a person's approval."
Juan Sebastián Velásquez, AI Engineer, GuruSup
Juanse describes this evolution in the article What changed when our agents started writing code, with code examples and execution traces showing how code mode changes the interaction between the model and its tools.
Key takeaways
- Build on a framework that grows with the product. GuruSup has used Pydantic AI since January 2025, expanding from customer support into an agent harness for broader company work.
- Compose capabilities around the assignment. Combine tool discovery, context management, sandbox workspaces, and human decisions, with custom capabilities for the behavior the product needs.
- Coordinate MCP tools through code. Code mode running in Monty lets a program orchestrate tool calls and process intermediate results, reducing model round trips and the data returned to context.
- Turn observability into improvement. Logfire helps the whole team investigate behavior, while GuruSup's agents monitor failures, notify the team, and create issues with supporting evidence.
Building agents that read your company's knowledge? Explore GuruSup, sign up for Logfire, try Agent Sandboxes in Pydantic Logfire, powered by Monty, or get started with code mode.
FAQ
What is GuruSup?
GuruSup is an AI operating system for company work that grew from a platform for automating customer support. Its Brain layer centralizes company knowledge and shared skills, exposing them through MCP to an agent harness built on Pydantic AI. The harness combines that context with connected applications so agents can carry out assignments.
Why did GuruSup choose Pydantic AI?
After testing several frameworks, GuruSup adopted Pydantic AI in January 2025 for its typing, structured outputs, and developer experience. The team has continued building on it because its direction fits GuruSup's approach to agents, with composable capabilities, code mode running in Monty, durable execution through Temporal, sandbox workspaces, and Logfire for observability and improvement.
How does GuruSup use Pydantic Monty with MCP?
With Pydantic AI Harness code mode enabled, agents can write Python that calls exposed tools, including Brain's MCP and connected application tools. Monty executes the program, which can coordinate multiple calls, run independent requests in parallel, follow pagination, and filter intermediate results before returning findings to the model. This can reduce model round trips and context use.
How does GuruSup use Logfire?
GuruSup uses Logfire to trace agent runs, inspect model requests and tool calls, and evaluate changes. Through its MCP server, the whole team can use agents to investigate platform behavior. GuruSup's own harness also monitors failures, investigates them, notifies the team, and creates issues with a diagnosis and supporting evidence.
How does GuruSup keep agent-written code under control?
Monty executes generated Python with access to the host functions GuruSup exposes. GuruSup configures memory and tool-call limits, and the host functions enforce permissions and approval requirements.
What is Pydantic Monty?
Pydantic Monty is an open-source interpreter written in Rust that runs a sandboxed subset of Python for AI agents. It provides controlled access to host functions, resource limits, and snapshots for pausing and resuming execution.