The Typescript
AI framework

Prototype and productionize AI features with a modern JS/TS stack.

Connect APIs & Data

Sync data from SaaS tools. Scrape the web. Pipe it into a vector store and RAG away.

mastra.config.ts


export const config: Config = {
  ...mastraConfig,
  integrations: [
    new FirecrawlIntegration({
       API_KEY: process.env.FIRECRAWL_API_KEY!
    }),
    new SlackIntegration({
       CLIENT_ID: process.env.SLACK_CLIENT_ID!,
       SCOPES: ['channels:manage', 'users:read', 'chat:write']
    })
  ],
  db: {
    provider: 'postgres',
    uri: process.env.DB_URL!
  }
},
SaaS
Scrapers

sync

vectorize

Mastra

cache

Your DB

Your AI

knowledge

base

Vector DB
lines

Create Workflows

Connect steps together with code or in a graph. See inputs and outputs for each step. Debug visually with replay capability.

mastra.config.ts


categorizeProblem.connect(createSupportTicket, {
	condition: (data) => !data.requriesTechnicalSupport
});

categorizeProblem.connect(createSupportTicket, {
	condition: (data) => !data.requriesTechnicalSupport
});
Conversational AgentWorkflow

Parse Data

Convert Data into plain text following a specified template

Template

{text}
Data
Text
Input
Output

Prompt

Create a prompt template with dynamic variables.

Template

{context} --- given the context above, answer...

Context

Question

Prompt Message
Input
Output

You will write the most engaging summary posts, but you'll write as a technical writer, without using any big words. You must output 1000 characters. These posts should summarize the most important topic from the article, while also following the guidelines, feedback, chat history and examples that are provided to you. A good summary post covers the most important topic from the article, and is educational/ informational but also teases a part of the article. You must have a great hook at the beginning of the post: a question or an interesting thought provoking statement. You can only use emojis in a bullet list and not at the beginning of the post.

OpenAI

Generates text using OpenAI LLMs.

Input

Model

gpt-4o

OpenAI API Key

api key...

Temperature

0.6
Text
Language Model
Input
Output

Chat Output

Display a chat message in the Playground.

Text

Text...
Message
Input
Output
lines

Assemble Agents

Use OpenAI Assistants or Vercel’s AI SDK to create agents that can chat, email, or complete tasks

mastra.config.ts


  export const config:Config = {
    ...mastraConfig,
    agents: {
      agentDirPath: '/mastra-agents',
      vectorProvider: [
        {
          name: 'PINECONE',
          apiKey: process.env.PINECONE_API_KEY!,
        },
      ],
    },
  }

workflow support

Embed complex logic as workflows and provide them to your agents

Configuration as code

Create agents visually, store configuraion as code

Drop-in integrations

Agents have access to APIs from 50+ SaaS providers

Totally open-source

Run on your own infrastructure or on your favorite serverless cloud

Knowledge sources

Sync data into a vector DB (Pinecone) for use in retrieval augmented generation (RAG)

lines

Backed by founders