🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

@ag-ui/mastra

Package Overview
Dependencies
Maintainers
2
Versions
31
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
1.0.2
Version published
Weekly downloads
17K
15.64%
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

Install the @ag-ui/mastra package:

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

Install the required peer dependencies:

npm install @mastra/client-js @mastra/core @ag-ui/core @ag-ui/client @copilotkit/runtime

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 integrations/mastra/typescript/examples
pnpm install
pnpm run dev

FAQs

Package last updated on 24 Apr 2026

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