update

Powered by Mastra: Finding the Right Foundation

The Build vs. Buy Decision

When we pivoted to Consul Agent, we faced a critical choice.

Building one AI agent is straightforward. You call a language model, parse the response, maybe add some tools. A competent developer can do it in a weekend.

Building 26 specialized agents that coordinate across email, SMS, and web chat—while managing calendars, emails, contacts, documents, and schedules—while running 24/7 for real users who depend on it? That's an entirely different problem.

We could build all of it ourselves. We had the skills. We had the time. We had the arrogance of thinking we could do it better than anyone else.

But we'd also learned something important over the past six months: the best product teams focus on what makes them unique, not on reinventing infrastructure.

What We Actually Needed

Here's what a production AI agent system requires:

Reliability that never sleeps. When you email your agent at 3am, it needs to respond. Not "usually responds" but "always responds." Retry logic. Error recovery. Graceful degradation. The kind of reliability that takes months to build right.

Memory that actually works. Your agent needs to remember that you prefer morning meetings. That you're in Pacific time. That you had lunch with John last month. Not just for one conversation, but across every interaction, forever.

Visibility into what's happening. When something goes wrong (and it will), you need to know exactly what happened. Which tool failed? What input caused the error? Where did the chain break? Production debugging without observability is just guessing.

Coordination between agents. The scheduling agent needs to talk to the calendar agent. The email agent needs to pass information to the drafting agent. These handoffs need to be reliable and traceable.

We estimated building all of this from scratch would take 4-6 months. And that's just to reach parity with existing solutions—not to add any unique value.

Discovering Mastra

In late December, we found Mastra.

Mastra is a TypeScript framework for building production AI systems. Not demos. Not prototypes. Systems that can run in production, 24/7, with real users depending on them.

It had everything we needed:

Agents with memory: Built-in conversation history and user preference tracking. Your agent remembers context across every interaction.

Reliable tool execution: Automatic retries with exponential backoff. Error handling that doesn't crash the entire system. Timeouts that prevent runaway operations.

Workflow orchestration: Multi-step operations that can pause, resume, and recover. When a complex scheduling negotiation spans multiple emails over days, the system keeps track.

Built-in observability: Every agent call traced. Every tool execution logged. Full visibility into what's happening and why.

The best part? It's TypeScript-first, which matched our entire codebase. Type safety throughout. No runtime surprises.

The Migration

On December 24th—yes, Christmas Eve—we migrated to Mastra v1.

It was a significant undertaking:

  • 89 tools adapted to Mastra's format
  • 26 specialized agents rebuilt on the new framework
  • 10 production workflows orchestrating complex operations
  • Complete type safety throughout

But the migration itself was smooth. Mastra's patterns are clean and intuitive. What we thought would take two weeks took five days.

What Changed After Mastra

The difference was immediate and measurable.

Development velocity jumped 3x. Building a new agent went from days to hours. The framework handles all the boilerplate—retry logic, error handling, memory management. We just write the actual logic.

Reliability improved dramatically. Before Mastra, we were debugging edge cases constantly. Random failures, context getting lost, tools timing out without recovery. After Mastra, these issues virtually disappeared. The framework handles them automatically.

Debugging went from painful to easy. When something does go wrong, we can trace the entire execution path. Which agent was called, which tools it used, what inputs it received, what outputs it generated. Issues that used to take hours to diagnose now take minutes.

Our Agent Architecture

With Mastra as the foundation, we built out our agent system:

Scheduling Intelligence: Agents that handle initial meeting requests, negotiate alternative times, send follow-ups, and coordinate across multiple calendars. A scheduling conversation that spans days and multiple emails is handled seamlessly.

Email Management: Agents that triage incoming messages, draft responses in your voice, and know when to escalate vs. handle automatically.

Calendar Coordination: Agents that read your availability, create events, manage conflicts, and understand your preferences (no meetings before 9am, buffer time between calls, etc.)

Document Handling: Agents that create meeting agendas, take notes, and organize your Google Drive.

Daily Intelligence: An agent that generates your morning briefing—what's on your calendar, what needs follow-up, what you might have forgotten.

Each agent is specialized for its domain but shares context through Mastra's memory system. The email agent knows what the calendar agent knows. The scheduling agent remembers your preferences from past interactions.

Why Framework Choice Matters

Here's the thing about infrastructure decisions: they compound.

Build on a shaky foundation, and every feature you add makes the shakiness worse. Build on a solid foundation, and every feature benefits from the stability beneath it.

Six months ago, we might have been tempted to build everything ourselves. We'd have spent those months wrestling with edge cases instead of building features.

By choosing Mastra, we got 6+ months of someone else's hard work on reliability, observability, and best practices. We got to focus on what makes Consul unique: the intelligence that helps you get time back.

What This Means for Users

If you're going to trust an AI to manage your calendar and email, it needs to work. Not "usually works." Not "works if you phrase things correctly." Just works.

Mastra gives us the foundation to deliver that reliability. When you email your Consul Agent, we can guarantee:

  • Your message will be processed (retry logic ensures it)
  • Context from previous conversations will be remembered
  • If something does go wrong, we'll know exactly what happened and can fix it

That's the kind of reliability that turns a demo into a product people can depend on.


Next up: How we connected every channel—email, iMessage, and web—to create a seamless experience across wherever you already communicate.

Consul Team