🚀 DAY 3 OF LAUNCH WEEK: Introducing Webhook Events for Pull Request Scans.Learn more →
Socket
Book a DemoInstallSign in
Socket

@ag-ui/mastra

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ag-ui/mastra

Implementation of the AG-UI protocol for Mastra.

latest
npmnpm
Version
0.2.0
Version published
Weekly downloads
6.3K
5.99%
Maintainers
2
Weekly downloads
 
Created
Source

@ag-ui/mastra

Implementation of the AG-UI protocol for Mastra.

Connects Mastra agents (local and remote) to frontend applications via the AG-UI protocol. Supports streaming responses, memory management, and tool execution.

Installation

npm install @ag-ui/mastra
pnpm add @ag-ui/mastra
yarn add @ag-ui/mastra

Usage

import { MastraAgent } from "@ag-ui/mastra";
import { mastra } from "./mastra"; // Your Mastra instance

// Create an AG-UI compatible agent
const agent = new MastraAgent({
  agent: mastra.getAgent("weather-agent"),
  resourceId: "user-123",
});

// Run with streaming
const result = await agent.runAgent({
  messages: [{ role: "user", content: "What's the weather like?" }],
});

Features

  • Local & remote agents – Works with in-process and network Mastra agents
  • Memory integration – Automatic thread and working memory management
  • Tool streaming – Real-time tool call execution and results
  • State management – Bidirectional state synchronization

To run the example server in the dojo

cd typescript-sdk/integrations/mastra/example
pnpm install
pnpm run dev

FAQs

Package last updated on 09 Oct 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts