0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/client-sdks/ai-sdk
History 2026-11-12 21:12:29 +00:00
..
__recordings__ fix(ai-sdk): approval responses on earlier messages were never resumed (#19528) 2026-07-16 10:26:37 +02:00
src Fix MCP core compatibility, Windows browser paths, and AI SDK tool titles (#30125) 2026-11-11 15:45:01 -08:00
.gitignore fix: rewrite inline import() in published .d.ts files (#13811) 2026-03-05 15:10:27 +01:00
CHANGELOG.md chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
lint-staged.config.js refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
oxlint.config.ts chore: migrate linting to oxlint (#20173) 2026-07-25 01:04:02 +02:00
package.json chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
README.md chore(*): Update/unify/add READMEs (#22858) 2026-09-02 14:36:59 +02:00
tsconfig.build.json Add new @mastra/ai-sdk pkg (#7263) 2025-09-02 23:56:07 +02:00
tsconfig.json chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
tsdown.config.ts Support AI SDK v7 in the @mastra/ai-sdk UI helpers (#21720) 2026-08-18 18:22:24 -07:00
turbo.json docs: make packages frontmatter more precise (#29499) 2026-11-04 17:49:54 -08:00
vitest.config.js refactor: reorganize core tests and namespace vitest projects across monorepo (#12662) 2026-02-09 10:24:48 +01:00
vitest.config.ts fix(ai-sdk): accept UIMessage from ai@7.0.103+ in v7 helpers (#24931) 2026-09-24 14:47:22 -07:00

@mastra/ai-sdk

The recommended way of using Mastra and AI SDK together is by installing the @mastra/ai-sdk package. @mastra/ai-sdk provides custom API routes and utilities for streaming Mastra agents in AI SDK-compatible formats. Including chat, workflow, and network route handlers, along with utilities and exported types for UI integrations.

Installation

npm install @mastra/ai-sdk

Usage

If you want to use dynamic agents you can use a path with :agentId.

import { chatRoute } from '@mastra/ai-sdk';

export const mastra = new Mastra({
  server: {
    apiRoutes: [
      chatRoute({
        path: '/chat/:agentId',
      }),
    ],
  },
});

Documentation

Changelog

See the package changelog for version history and release notes.

Support

We have an open community Discord. Come and say hello and let us know if you have any questions or need any help getting things running.