Google ADK and Mastra, agents with a built-in dev loop
This last doc pairs two frameworks that people often discover in the same week: Google's Agent Development Kit (ADK) and Mastra. They come from very different places (ADK from Google Cloud, Mastra from a TypeScript startup team), but they share a philosophy I like: code first agents, a graph based workflow runtime next to them, and a local web UI for running and inspecting everything. As of October 2026, google-adk on PyPI is on 2.12 (with TypeScript, Go, Java and Kotlin versions too) and @mastra/core on npm is on 1.78.
Why it matters
Agents are hard to develop without seeing them. You want to type a message, watch which tools fire, inspect state, replay a step and tweak a prompt, all without writing a frontend. Both frameworks ship that loop:
- ADK gives you
adk runfor a terminal session andadk webfor a development UI, plusadk deploytargets for Docker, Cloud Run and Vertex AI Agent Engine. - Mastra gives you
mastra dev, which starts a local server and Studio, where you can chat with agents, run workflows from a generated input form, watch live step status and time travel through a run.
Beyond the dev loop, each covers the full stack an agent app needs.
ADK (from its README and docs): an Agent class for LLM agents with instructions and tools; a Workflow runtime for deterministic, graph based flows with routing, fan out and fan in, loops, retries, state, human in the loop and nested workflows; a Task API for structured agent to agent delegation; a rich tool ecosystem (pre-built tools like Google Search, custom functions, OpenAPI specs, MCP); tool confirmation for approvals; and A2A protocol support for exposing and consuming remote agents. It is optimized for Gemini and Google Cloud, but works with other models.
Mastra: Agent with instructions, model strings like "openai/...", tools defined with createTool and Zod schemas, and memory for conversation history; createWorkflow and createStep for typed workflows with .then() chaining, suspend and resume, and streaming; plus observability, evals and MCP support, all registered on one Mastra instance.
How it works
The shared shape: a central registry or root object, agents for judgment, workflows for control, and a dev server on top.
Rendering diagram…
In ADK, the convention is a root_agent variable in your agent module; the CLI and dev UI discover it. A Workflow is itself usable as a root agent, with edges describing the order, for example ("START", agent_a, agent_b).
In Mastra, you create agents and workflows in their own files and register them on new Mastra({ agents, workflows }), usually in src/mastra/index.ts. Your application then gets them by id, such as mastra.getAgentById("support-agent").
Reference architecture
How I would deploy each in production:
Rendering diagram…
In practice you rarely run both. Pick ADK if your backend is Python (or Java, Go, Kotlin) on Google Cloud; pick Mastra if your backend is TypeScript.
Code
An ADK agent with Google Search and a two step workflow, following the ADK README:
# my_agent/agent.py
from google.adk import Agent, Workflow
from google.adk.tools import google_search
researcher = Agent(
name="researcher",
model="gemini-flash-latest",
instruction="Research the user's topic thoroughly and list key facts.",
tools=[google_search],
)
writer = Agent(
name="writer",
model="gemini-flash-latest",
instruction="Turn the research notes into a five sentence briefing.",
)
root_agent = Workflow(
name="root_agent",
edges=[("START", researcher, writer)],
)
Run it with adk run my_agent in the terminal or adk web for the dev UI.
A Mastra agent with a tool, and a workflow, following the Mastra agents and workflows docs:
// src/mastra/index.ts
import { Mastra } from "@mastra/core";
import { Agent } from "@mastra/core/agent";
import { createTool } from "@mastra/core/tools";
import { createStep, createWorkflow } from "@mastra/core/workflows";
import { z } from "zod";
const orderTool = createTool({
id: "get-order",
description: "Get the status of an order",
inputSchema: z.object({ orderId: z.string().describe("Order id") }),
execute: async ({ orderId }) => ({ orderId, status: "shipped" }),
});
export const supportAgent = new Agent({
id: "support-agent",
name: "Support Agent",
instructions: "You help customers with order questions. Use tools.",
model: "openai/gpt-5.4-mini",
tools: { orderTool },
});
const normalize = createStep({
id: "normalize",
inputSchema: z.object({ message: z.string() }),
outputSchema: z.object({ formatted: z.string() }),
execute: async ({ inputData }) => ({ formatted: inputData.message.trim() }),
});
export const intakeWorkflow = createWorkflow({
id: "intake-workflow",
inputSchema: z.object({ message: z.string() }),
outputSchema: z.object({ formatted: z.string() }),
})
.then(normalize)
.commit();
export const mastra = new Mastra({
agents: { supportAgent },
workflows: { intakeWorkflow },
});
Using them from your app:
import { mastra } from "./mastra";
const agent = mastra.getAgentById("support-agent");
const reply = await agent.generate("Where is order 1042?");
console.log(reply.text);
const run = await intakeWorkflow.createRun();
const result = await run.start({ inputData: { message: " refund please " } });
if (result.status === "success") console.log(result.result);
Run mastra dev to open Studio and try both interactively.
Trade-offs and pitfalls
- Ecosystem gravity. ADK is smoothest with Gemini, Vertex AI and Cloud Run; it works elsewhere but you will feel the defaults. Mastra is cloud neutral but TypeScript only.
- Fast release cadence. ADK releases roughly every two weeks and Mastra ships very frequently. Pin versions, and recheck examples against your installed version (ADK's 2.x
WorkflowAPI, for example, differs from older 1.x tutorials that used separate sequential, parallel and loop agent classes). - Dev UI is not production.
adk weband Studio are for development. Deploy behind your own API with auth, rate limits and logging. - Workflows versus agents. Both frameworks make it easy to wrap everything in an agent. Use deterministic workflow steps for anything that does not need judgment; it is cheaper and testable.
- State and storage. Suspend and resume, sessions and memory need a real storage backend in production. Configure it explicitly instead of relying on in memory defaults.
- A2A is powerful but adds a network boundary. Remote agents need versioning, auth and timeouts like any other service.
When to pick ADK: Python or JVM backends on Google Cloud, Gemini first products, teams that want Google's deployment targets (Cloud Run, Agent Engine) and agent to agent interoperability via A2A.
When to pick Mastra: TypeScript backends that want agents, workflows, memory and evals in one framework with a strong local dev experience, often alongside the Vercel AI SDK on the frontend.
When not to use either: a single model call or a small chat feature (use the provider SDK or AI SDK Core), or a team already invested in LangGraph or another runtime that covers the same ground.
Checklist
- Choose by backend language and cloud first, features second.
- Use the dev UI (
adk webor Studio) on every new agent before writing tests. - Model deterministic steps as workflow steps, not agent instructions.
- Define tool schemas precisely (Python type hints or Zod).
- Configure durable storage for sessions, memory and suspended runs.
- Pin framework versions and check examples against your installed release.
- Put production traffic behind your own authenticated API.