How Lindy Replaced Its Homegrown Agent Harness with Mastra to Run Tasks 2× Faster
Maintaining a custom harness was pulling Lindy's engineers away from the product. On Mastra, the team shipped a more lightweight core that runs tasks faster and 3-4x cheaper.
~500K
Lines of code removed during migration
2 FTEs
Of engineering time freed up
Lindy is an AI employee that connects to a team's tools and company knowledge to carry out all kinds of tasks, from handling emails and scheduling meetings to reviewing PRs. It now serves thousands of customers, with users at companies like Shopify, NVIDIA, and Adobe. Its revenue grew 5× over six months in 2025.
To support that growth, the team replaced their maintenance-heavy homegrown harness with Mastra. The switch cut infrastructure costs, made the codebase easier for coding agents to work with, and freed up the equivalent of two engineers' time for product work.
What makes Lindy different
Most AI assistants are designed to take instructions from one person. Lindy works alongside a team. Multiple people can talk to it in the same Slack thread, each bringing their own tools, context, and permissions into the conversation.
Lindy needs to know who it's talking to as people take turns. For example, it can use someone's calendar to help schedule a meeting, but it shouldn't make their private appointments available to everyone else in the thread. This way, different people can collaborate with it as if it were just another teammate, while keeping control over private information.
Lindy can also take on recurring responsibilities, within the permissions it's given. It can triage emails, review PRs, or flag conversations that need attention without waiting for someone to ask each time.
And to make Lindy even more autonomous, the company is now introducing long-running goals. A team could ask it to increase newsletter conversions from 2% to 4.5%, and Lindy would figure out the steps, run experiments, and use changes in the metric to trigger the next steps.
The limits of the homegrown harness
Lindy's team started building before existing frameworks offered many of the agent capabilities they needed, so they built their own.
As the product evolved, those solutions accumulated into a custom agent harness. The system used a state graph: behind the scenes, an agent followed nodes in a workflow to complete a task. It was easy for humans to read, but could be inefficient in cost, latency, and execution.
Over time, maintaining that framework took more and more attention away from the product, and it started slowing the team down. A patch in one part of the system could change how tasks ran elsewhere, which in turn affected the evals suite and other components of the system. All the accumulated tech debt made it very difficult to update the framework and trace regressions.
The launch of Lindy's shared AI teammate added more pressure and challenges. The harness had to support conversations where several people took turns, each with different context and permissions.
Tool selection was another challenge. Across a large integration catalog, many providers offered similar operations. The agent had to find relevant tools, compare the candidates, and choose the right one without making every search slow or expensive.
Long conversations also required memory management and compaction. All of this had to work with Lindy's existing systems.
Migrating to Mastra
The team considered whether to keep investing in a custom framework they'd been building over the last few years or switch to an off-the-shelf solution. Ultimately, they decided to remove the maintenance load so the engineering team could focus its energy on building the product.
"It just didn't make sense anymore to maintain this home-rolled harness when something like Mastra exists, which is literally specializing in making the best harness you can use." — Bruno Škvorc, Staff Software Engineer
The team replaced the state-graph architecture with a simpler agent loop on Mastra and redesigned the underlying data model. The new implementation builds context across successive model calls and uses caching to reduce repeated processing.
Lindy extended Mastra's tool search with classifiers and decision models that rank candidates and distinguish between providers. Making that search cacheable helped keep token costs down.
The team also extended Mastra's memory-management primitives and connected the new runtime to its existing product infrastructure. Lindy kept its own evaluation system, which covers the tasks and tools its agents use.
"Integrating Mastra took more than just replacing the framework. We had to hook it into the rest of our system: billing, authorization, integrations, authentication, logging, tracing. All of this was incredibly comprehensive and convoluted. Luckily, Mastra has amazing APIs that made this very, very smooth to do." — Bruno Škvorc, Staff Software Engineer
Results and next steps
The switch cut infrastructure costs and removed roughly half a million lines of code from the old implementation. Much of that volume was replaced by tests, but the application logic became much smaller.
That smaller codebase fits into the context window of most coding agents now. So the coding agents Lindy's engineers use can understand it and reason about it better, helping the team be more efficient when shipping updates.
The switch also freed up the equivalent of two engineers' time for product development and optimization. Škvorc now manages the Mastra implementation mostly on his own, while the team spends more attention on the product, speed, infrastructure, and load testing.
The new core is launching in November 2026. The team expects tasks to run at least twice as fast and customers to get three to four times more usage from their credits, depending on the task.
