mirror of
https://github.com/mastra-ai/mastra.git
synced 2026-11-17 08:44:46 +00:00
|
History
|
||
|---|---|---|
| .. | ||
| __recordings__ | ||
| src | ||
| .gitignore | ||
| CHANGELOG.md | ||
| lint-staged.config.js | ||
| oxlint.config.ts | ||
| package.json | ||
| README.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| tsdown.config.ts | ||
| turbo.json | ||
| vitest.config.js | ||
| vitest.config.ts | ||
@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.