ag-ui-mastra
v1.0.3
Published
Implementation of the AG-UI protocol for Mastra.
Downloads
77
Readme
@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/mastraUsage
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