Cian Hughes, Chief Scientific Officer at Counsel Health, was working on AI healthcare projects at Google when he started to see a pattern.
He'd trained as an ENT surgeon and worked as an emergency medicine doctor, watching countless patients suffer through the experience of waiting in Urgent Care or the ER because they couldn’t see their Primary Care Physician (PCP). He’d also heard lots of stories from friends and patients where they’d block two hours in their diary waiting for a call from their doctor, only to have the call come just as those two hours had ended and they were picking up their kids from school or stuck in a meeting.
"So many patients need timely treatment to medical concerns that aren't quite an emergency," Hughes explains. "And it's so desperately inefficient and so unpleasant an experience for those patients to default to emergency rooms or urgent care."
Meanwhile, through his work at Google on projects like AMIE, Hughes had started building "prompt harnesses"—carefully written prompts where one component connected to another. This was before the phrase "agents" had been widely popularized in the context of LLMs, but the shape was the same: the conceptual building blocks that Mastra gives you today.
When Google Ventures invested in Counsel Health, a virtual care platform founded by emergency medicine doctors, Hughes saw his chance to move from research to real-world impact. He joined the company and, about ten days in, made an observation that would reshape their technical architecture.
"We really need to be using an agent framework," he told the team.
Building the future of care
Counsel Health is an AI-enabled, physician-supervised virtual care company on a mission to multiply the world's clinical capacity. They deliver high-quality care through a simple chat interface, combining medical AI with board-certified physicians to give members guidance that is continuous, secure, and always available.
Support from Counsel spans five key use cases: personalized care, instant medical advice, health results review, lab ordering, and medication management.

"Upwards of 90% of patients seen in urgent care could be treated in another setting if they had rapid access to a primary care physician," says Hughes. Counsel Health makes that access possible. Patients message back and forth asynchronously with its medical AI, add a physician with one click, and get personalized treatment plans, prescriptions or referrals without the need to be on the phone for two hours to try and schedule a traditional in-person appointment with a PCP.
Counsel Health’s stack
Here’s a high-level breakdown of how Counsel Health built their app:
Frontend: Counsel uses Next.js for both their user and physician facing applications.
Orchestration: Counsel takes full advantage of Mastra workflows to coordinate the core history taking agents alongside parallel supervisor agents (e.g. for identifying potential medical emergencies). Agent routing ensures that common tasks (e.g ordering a lab test) are routed to a dedicated special-purpose agent. Counsel have also built a suite of custom tools including a RAG tool that surface clinical best-practice guidelines and a search tools to pull in relevant information from the user's medical record.
Hosting: Counsel hosts both the Mastra server and the applications servers in a Kubernetes cluster running within a private cloud environment. This unified DevOps workflow simplifies HIPAA compliance and ensures security and privacy of patient data.
Choosing Mastra as the agent framework
When Hughes joined, Counsel Health already had a working agentic history-taking system built directly on OpenAI's agent APIs within a Next.js app. But it had been started 14-15 months earlier, before any agent framework met their needs.
"The ability to make changes or run parallel experiments wasn't quite there," Hughes recalls. "And while there were runtime metrics, standing up any new performance metric was a huge manual effort."
Hughes evaluated everything in the market—Genkit from Google, LangChain, and others—before settling on Mastra.
Two factors sealed the decision. First, Mastra was simply a well-written, considered framework. Second, and perhaps more importantly, it kept the entire team working in the same language.
"I've worked in teams where AI researchers were far away developing prototypes in Python notebooks," Hughes explains. "Or you have a separate agentic service managed only by the AI team because full-stack developers aren't familiar with Python or Go. With Mastra, our AI researchers stay close to the product. Everyone works in TypeScript."
Now the team iterates directly in Mastra Studio—tweaking system prompts, running experiments, and shipping improvements without the translation layer that slows down so many AI teams.
Crafting an agent for patients, and an agent for physicians
What makes Counsel Health's implementation particularly interesting is that Mastra powers both sides of the care experience.
On the patient side, an AI agent handles the initial history-taking phase before the patient ever sees a doctor. On the physician side, a clinician cockpit surfaces relevant results and context, making its in-house physicians more effective.
"The clinician cockpit pulls and surfaces the relevant lab results, patient history, and prior interactions—everything the doctor needs," says Hughes. "This is also powered by Mastra."
Counsel's agents are HIPAA-compliant and SOC2 secure. They use the same encrypted-at-rest infrastructure that stores physician-patient conversations to hold users' threads. This gives Counsel physicians the ability to review conversations with its medical AI before asking any follow-up questions to effectively triage care for each member.
Looking Forward
Counsel Health's Chief Medical Officer, Dr Rishi Khakhkhar, advocates for an entirely new specialty: asynchronous care delivery. It crosses emergency medicine, urgent care, and primary care.
"What would it be like if the whole world had perfect doctors?" Hughes asks. "Imagine being able to reach a doctor exactly when you need one, instantly, conveniently, and with the confidence that they know your full medical history and remember every interaction over time."
That's the vision Counsel Health is building toward. And with Mastra handling the agent orchestration, they can focus on what matters: making healthcare actually accessible.