github mastra-ai/mastra @mastra/core@0.20.1
2025-10-08

latest releases: mastra@0.15.1, create-mastra@0.15.1, @mastra/server@0.20.2...
23 hours ago

Highlights

Workflows

Workflows now support global state, you can now read state in each of your defined steps and set it withsetState. This makes it easier to manage state over multiple steps nstead of passing it through input/output variables.

const firstStep = createStep({
  id: "first-step",
  execute({ setState }) {
    setState({
      myValue: "a value",
    });
  },
});

const secondStep = createStep({
  id: "second-step",
  execute({ state }) {
    console.log(state.myValue);
  },
});

createWorkflow({
  id: "my-worfklow",
  stateSchema: z.object({
    myValue: z.string(),
  }),
}).then(myStep);

Memory

Working memory can be stored using thread metadata. It allows you to set the initial wokring memory directly.

const thread = await memory.createThread({
  threadId: "thread-123",
  resourceId: "user-456",
  title: "Medical Consultation",
  metadata: {
    workingMemory: `# Patient Profile
- Name: John Doe
- Blood Type: O+
- Allergies: Penicillin
- Current Medications: None
- Medical History: Hypertension (controlled)`,
  },
});

UI (ai-sdk compatability)

Improved useChat support from ai-sdk if you're using agents in your tools. You get a custom UI message called data-tool-agent with all relevant information.

// in src/mastra.ts
export const mastra = new Mastra({
  server: {
    apiRoutes: [
      chatRoute({
        path: "/chat",
        agent: "my-agent",
      }),
    ],
  },
});
// in my useChat file
const { error, status, sendMessage, messages, regenerate, stop } =
  useChat<MyMessage>({
    transport: new DefaultChatTransport({
      api: 'http://localhost:4111/chat',
      body: {

      }
    }),
  });

return (
  <div className="flex flex-col pt-24 mx-auto w-full max-w-4xl h-screen">
    <div className="flex flex-row mx-auto w-full overflow-y-auto gap-4">
      <div className="flex-1">
        {messages.map(message => {
          return (
            <div key={message.id} className="whitespace-pre-wrap">
              {message.role === 'user' ? 'User: ' : 'AI: '}{' '}
              {message.parts
                .filter(part => part.type === 'data-tool-agent')
                .map((part) => {
                  return <CustomWidget key={part.id} {...part.data} />
                })}
              {message.parts
                .filter(part => part.type === 'text')
                .map((part, index) => {
                  if (part.type === 'text') {
                    return <div key={index}>{part.text}</div>;
                  }
                })
              }
          )
        }}
      </div>
    </div>
  </div>
)

Changelog

@mastra/agent-builder

  • Fix TypeScript errors with provider-defined tools by updating ai-v5 and openai-v5 to matching provider-utils versions. This ensures npm deduplicates to a single provider-utils instance, resolving type incompatibility issues when passing provider tools to Agent.

    Also adds deprecation warning to Agent import from root path to encourage using the recommended subpath import. (#8584)

@mastra/ai-sdk

  • Mutable shared workflow run state (#8545)
  • Add support for streaming nested agent tools (#8580)

@mastra/chroma

@mastra/client-js

  • Mutable shared workflow run state (#8545)
  • add tripwire reason in playground (#8568)

@mastra/core

  • workflow run thread more visible (#8539)

  • Add iterationCount to loop condition params (#8579)

  • Mutable shared workflow run state (#8545)

  • avoid refetching memory threads and messages on window focus (#8519)

  • add tripwire reason in playground (#8568)

  • Add validation for index creation (#8552)

  • Save waiting step status in snapshot (#8576)

  • Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai (#8559)

  • type fixes and missing changeset (#8545)

  • Convert WorkflowWatchResult to WorkflowResult in workflow graph (#8541)

  • add new deploy to cloud button (#8549)

  • remove icons in entity lists (#8520)

  • add client search to all entities (#8523)

  • Improve JSDoc documentation for Agent (#8389)

  • Properly fix cloudflare randomUUID in global scope issue (#8450)

  • Marked OTEL based telemetry as deprecated. (#8586)

  • Add support for streaming nested agent tools (#8580)

  • Fix TypeScript errors with provider-defined tools by updating ai-v5 and openai-v5 to matching provider-utils versions. This ensures npm deduplicates to a single provider-utils instance, resolving type incompatibility issues when passing provider tools to Agent.

    Also adds deprecation warning to Agent import from root path to encourage using the recommended subpath import. (#8584)

  • UX for the agents page (#8517)

  • add icons into playground titles + a link to the entity doc (#8518)

@mastra/dane

  • Mutable shared workflow run state (#8545)

@mastra/deployer

  • fix: custom API routes now properly respect authentication requirements

    Fixed a critical bug where custom routes were bypassing authentication when they should have been protected by default. The issue was in the isProtectedPath function which only checked pattern-based protection but ignored custom route configurations.

    • Custom routes are now protected by default or when specified with requiresAuth: true
  • Custom routes properly inherit protection from parent patterns (like /api/*)

  • Routes with explicit requiresAuth: false continue to work as public endpoints

  • Enhanced isProtectedPath to consider both pattern matching and custom route auth config

    This fixes issue #8421 where custom routes were not being properly protected by the authentication system. (#8469)

  • Correctly handle errors in streams. Errors (e.g. rate limiting) before the stream begins are now returned with their code. Mid-stream errors are passed as a chunk (with type: 'error') to the stream. (#8567)

  • Mutable shared workflow run state (#8545)

  • Fix bug when lodash dependencies where used in subdependencies (#8537)

@mastra/deployer-cloud

  • Mutable shared workflow run state (#8545)
  • Add dynamic creation of peerdeps (#8582)

@mastra/deployer-cloudflare

  • Mutable shared workflow run state (#8545)
  • Properly fix cloudflare randomUUID in global scope issue (#8450)

@mastra/deployer-netlify

  • Mutable shared workflow run state (#8545)

@mastra/deployer-vercel

  • Mutable shared workflow run state (#8545)

@mastra/dynamodb

@mastra/inngest

  • Mutable shared workflow run state (#8545)
  • Handle workflow run failures (fix #8130) (#8370)

@mastra/langsmith

@mastra/longmemeval

  • Mutable shared workflow run state (#8545)

@mastra/mcp

  • Mutable shared workflow run state (#8545)

@mastra/mcp-docs-server

  • Mutable shared workflow run state (#8545)

@mastra/memory

  • Ensure working memory can be updated througb createThread and updateThread (#8513)

  • Fix TypeScript errors with provider-defined tools by updating ai-v5 and openai-v5 to matching provider-utils versions. This ensures npm deduplicates to a single provider-utils instance, resolving type incompatibility issues when passing provider tools to Agent.

    Also adds deprecation warning to Agent import from root path to encourage using the recommended subpath import. (#8584)

@mastra/pg

  • Add validation for index creation (#8552)

@mastra/playground-ui

  • workflow run thread more visible (#8539)
  • Mutable shared workflow run state (#8545)
  • streamLegacy/generateLegacy clarification in playground (#8468)
  • add tripwire reason in playground (#8568)
  • Save waiting step status in snapshot (#8576)
  • Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai (#8559)
  • type fixes and missing changeset (#8545)
  • Convert WorkflowWatchResult to WorkflowResult in workflow graph (#8541)
  • remove icons in entity lists (#8520)
  • extract mcp servers into playground + use a table instead of custom stuff (#8521)
  • add client search to all entities (#8523)
  • UX for the agents page (#8517)
  • add icons into playground titles + a link to the entity doc (#8518)

@mastra/react

  • Mutable shared workflow run state (#8545)
  • add tripwire reason in playground (#8568)
  • type fixes and missing changeset (#8545)
  • Convert WorkflowWatchResult to WorkflowResult in workflow graph (#8541)

@mastra/s3vectors

@mastra/server

  • Mutable shared workflow run state (#8545)

  • Fix TypeScript errors with provider-defined tools by updating ai-v5 and openai-v5 to matching provider-utils versions. This ensures npm deduplicates to a single provider-utils instance, resolving type incompatibility issues when passing provider tools to Agent.

    Also adds deprecation warning to Agent import from root path to encourage using the recommended subpath import. (#8584)

create-mastra

  • Mutable shared workflow run state (#8545)
  • streamLegacy/generateLegacy clarification in playground (#8468)
  • avoid refetching memory threads and messages on window focus (#8519)
  • add tripwire reason in playground (#8568)
  • Save waiting step status in snapshot (#8576)
  • Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai (#8559)
  • Convert WorkflowWatchResult to WorkflowResult in workflow graph (#8541)
  • Fix useStreamWorkflow unmounting breaking stream call (#8449)

mastra

  • workflow run thread more visible (#8539)
  • Mutable shared workflow run state (#8545)
  • streamLegacy/generateLegacy clarification in playground (#8468)
  • avoid refetching memory threads and messages on window focus (#8519)
  • add tripwire reason in playground (#8568)
  • Save waiting step status in snapshot (#8576)
  • Added AI SDK provider packages to model router for anthropic/google/openai/openrouter/xai (#8559)
  • Convert WorkflowWatchResult to WorkflowResult in workflow graph (#8541)
  • add new deploy to cloud button (#8549)
  • remove icons in entity lists (#8520)
  • add client search to all entities (#8523)
  • Fix useStreamWorkflow unmounting breaking stream call (#8449)
  • Remove shell from dev (#8466)
  • UX for the agents page (#8517)
  • add icons into playground titles + a link to the entity doc (#8518)

Don't miss a new mastra release

NewReleases is sending notifications on new releases.