WhoBuilt

AI Pipelines and Agents in Pure TypeScript with Mastra.ai

Jul 12, 2025· 1 h 51 min· 9.6K views·Watch on YouTube

Speakers

Nick Nisi, developer experience at WorkOS, and Zack Proser, an application and infrastructure developer focused on GenAI, MLOps, and RAG at WorkOS, lead a hands-on AI Engineer workshop on building TypeScript pipelines and agents with Mastra.ai.

Mastra building blocks

Nick describes Mastra as a framework for production AI applications, with typed workflows, tools, and conversational agents. Its playground, persistence, memory, observability, and evaluations help developers build and inspect applications. Workflows handle ordered steps; agents can choose tools or run a workflow when given access to it.

Build a meme generation workflow

Zack lays out the workshop project: turn a workplace frustration into a meme by analyzing the input, selecting an Imgflip template, generating captions, and publishing the result. The presenters use OpenAI and Imgflip, and say developers can test each step separately before connecting it to an agent. The workshop materials include a Markdown guide and Git branch checkpoints.

Use schemas and the playground to iterate

Nick explains that Zod schemas validate and shape model output at runtime, while Mastra also includes a structured output layer to improve generation. In the playground, developers can inspect each workflow step's inputs and outputs, adjust prompts and model settings, and debug locally. The demo shows a frustration analysis flowing through four steps to generate a meme.

Choose workflows for predictable sequences

In response to a question, Nick distinguishes workflows, which run steps in an intended sequence, from tools that an agent can choose among at runtime. Mastra can give an agent access to both, though Nick cautions that presenting an agent with many tools can make its choices less predictable. The presenters also discuss workflows as a way to compose steps and branching logic.

Connect an agent and consider production use

Nick connects the completed workflow to a conversational meme generator agent, which can run it and show the image and execution details in chat. Zack describes Mastra's TypeScript foundation, evaluations, local playground, and deployment options, including Hono, Cloudflare, Netlify, and Mastra Cloud. They suggest applying the same patterns to internal tools and routine tasks, while encouraging experimentation and code review.

Takeaways

  • Use workflows when a task needs a defined sequence of steps; expose tools when an agent should choose actions at runtime.
  • Validate model output with runtime schemas before passing it to later steps.
  • Test and inspect individual workflow steps in the playground before wiring them into an agent.
  • Give agents only the tools and workflows they need for a task.
  • Try small internal automations, then review generated code and evaluate pipeline quality.

Mentioned in this talk

Search inside this talk

What was claimed 10

Show all 10 facts

Related talks