0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/workflows
dane-ai-mastra[bot] 3c7d26e6ab
chore: version packages (alpha) (#30516)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and publish to npm
yourself or [setup this action to publish
automatically](https://github.com/changesets/action#with-publishing). If
you're not ready to do a release yet, that's fine, whenever you add more
changesets to main, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`main` is currently in **pre mode** so this branch has prereleases
rather than normal releases. If you want to exit prereleases, run
`changeset pre exit` on `main`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases

> The changelog information of each package has been omitted from this
message, as the content exceeds the size limit.

## @mastra/factory@0.29.0-alpha.5


## mastra@1.40.0-alpha.4


## @mastra/core@1.84.0-alpha.4


## @mastra/playground-ui@69.1.0-alpha.4


## @mastra/libsql@1.31.0-alpha.2


## @mastra/pg@1.37.0-alpha.2


## @mastra/client-js@1.60.1-alpha.4


## @mastra/react@1.15.1-alpha.4


## @mastra/deployer-cloud@1.84.0-alpha.4


## @mastra/longmemeval@1.1.43-alpha.4


## @mastra/opencode@0.1.43-alpha.4


## create-factory@0.4.4-alpha.4


## @mastra/code-sdk@1.19.1-alpha.5


## mastracode@0.50.1-alpha.5


## @mastra/deployer@1.84.0-alpha.4


## @mastra/mcp-apps-components@0.1.1-alpha.1


## @mastra/mcp-docs-server@1.3.14-alpha.4


## @mastra/server@1.84.0-alpha.4


## @mastra/redis-streams@0.9.0-alpha.2


## @mastra/elysia@0.1.24-alpha.4


## @mastra/express@1.5.28-alpha.4


## @mastra/fastify@1.5.28-alpha.4


## @mastra/hono@1.7.26-alpha.4


## @mastra/koa@1.7.28-alpha.4


## @mastra/nestjs@0.3.1-alpha.4


## @mastra/next@0.2.42-alpha.4


## @mastra/tanstack-start@0.2.42-alpha.4


## @mastra/convex@1.9.1-alpha.2


## @mastra/turso@0.1.22-alpha.2


## @mastra/inngest@1.11.3-alpha.0


## @mastra/temporal@0.6.1-alpha.4


## @mastra/platform-workspace@1.13.1-alpha.0


## create-mastra@1.40.0-alpha.4


## @internal/playground@1.40.0-alpha.4

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
History 2026-11-16 23:44:41 +01:00
..
_test-utils feat(core, pg, libsql, server): run evented workflows and durable agents on storage v2 (#29370) 2026-11-16 08:23:06 -08:00
inngest chore: version packages (alpha) (#30516) 2026-11-16 23:44:41 +01:00
temporal chore: version packages (alpha) (#30516) 2026-11-16 23:44:41 +01:00
oxlint.config.ts chore: migrate linting to oxlint (#20173) 2026-07-25 01:04:02 +02:00
README.md fix(docs): Fix Inngest example (#5500) 2025-07-01 09:43:13 -07:00

Inngest Workflow Engine

Run Mastra workflows with Inngest.

Workflow and step execution functionality is exposed via serve from @mastra/inngest. This is a wrapper that detects all Mastra workflows created to run with Inngest and registers them to the Inngest server.

Steps and workflows are created using the createStep and createWorkflow functions initialized with init() from @mastra/inngest. This makes sure that all the steps are ready and able to connect with the Inngets runtime, publish events for watching, etc.

The Inngest runtime is horizontally scalable, with watching and eventing working through the @inngest/realtime package.

Usage

Running inngest dev server

docker run --rm -p 8288:8288 \
  inngest/inngest \
  inngest dev -u http://host.docker.internal:4111/inngest/api

Example

import { init, serve as inngestServe } from '@mastra/inngest';
import { PinoLogger } from '@mastra/loggers';
import { Inngest } from 'inngest';
import { z } from 'zod';

const inngest = new Inngest({
  id: 'mastra',
  baseUrl: `http://localhost:8288`, // if using local dev server
});

const { createWorkflow, createStep } = init(inngest);

const incrementStep = createStep({
  id: 'increment',
  inputSchema: z.object({
    value: z.number(),
  }),
  outputSchema: z.object({
    value: z.number(),
  }),
  execute: async ({ inputData }) => {
    return { value: inputData.value + 1 };
  },
});

const sideEffectStep = createStep({
  id: 'side-effect',
  inputSchema: z.object({
    value: z.number(),
  }),
  outputSchema: z.object({
    value: z.number(),
  }),
  execute: async ({ inputData }) => {
    console.log('log', inputData.value);
    return { value: inputData.value };
  },
});

const finalStep = createStep({
  id: 'final',
  inputSchema: z.object({
    value: z.number(),
  }),
  outputSchema: z.object({
    value: z.number(),
  }),
  execute: async ({ inputData }) => {
    return { value: inputData.value };
  },
});

const incrementWorkflow = createWorkflow({
  id: 'increment-workflow',
  inputSchema: z.object({
    value: z.number(),
  }),
  outputSchema: z.object({
    value: z.number(),
  }),
})
  .dountil(
    createWorkflow({
      id: 'increment-subworkflow',
      inputSchema: z.object({
        value: z.number(),
      }),
      outputSchema: z.object({
        value: z.number(),
      }),
      steps: [incrementStep, sideEffectStep],
    })
      .then(incrementStep)
      .then(sideEffectStep)
      .commit(),
    async ({ inputData }) => inputData.value >= 10,
  )
  .then(finalStep)
  .commit();

export const mastra = new Mastra({
  vnext_workflows: {
    incrementWorkflow,
  },
  server: {
    host: '0.0.0.0',
    apiRoutes: [
      {
        path: '/inngest/api', // this needs to match the path in inngest dev server (or production) config
        method: 'ALL',
        createHandler: async ({ mastra }) => inngestServe({ mastra, inngest }),
      },
    ],
  },
  logger: new PinoLogger({
    name: 'Mastra',
    level: 'info',
  }),
});