0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/agent-builder
History 2026-11-12 21:12:29 +00:00
..
integration-tests chore(deps): update dependency @ai-sdk/provider-utils@>=3.0.0 <3.0.38 to v3.0.45 (#29844) 2026-11-10 20:07:34 -08:00
src fix(server): give each Mastra instance its own agent-builder workflows (#29253) 2026-11-03 15:26:49 -03: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
package.json chore: version - exit prerelease mode 2026-11-12 21:12:29 +00:00
README.md fix(server): give each Mastra instance its own agent-builder workflows (#29253) 2026-11-03 15:26:49 -03:00
tsconfig.build.json fix agent builder pkg (#7330) 2025-09-03 08:43:12 +02:00
tsconfig.json refactor(lint): replace ESLint with type-aware oxlint (#27476) 2026-10-18 10:38:35 -07:00
tsdown.config.ts fix(core,agent-builder): ship every file referenced by package exports (#29056) 2026-10-30 14:35:14 -07:00
turbo.json chore: migrate package builds to tsdown (#19829) 2026-07-28 12:32:21 +02:00
vitest.config.ts refactor: reorganize core tests and namespace vitest projects across monorepo (#12662) 2026-02-09 10:24:48 +01:00

@mastra/agent-builder

@mastra/agent-builder is a specialized agent that turns natural-language requirements into Mastra applications, agents, tools, and workflows. This experimental package requires a Mastra Enterprise license for production use, and its APIs may change without notice.

Installation

npm install @mastra/agent-builder

Usage

Set a supported model and the path to a Mastra project.

import { AgentBuilder } from '@mastra/agent-builder';

const builder = new AgentBuilder({
  model: 'openai/gpt-5.6-sol',
  summaryModel: 'openai/gpt-5.6-sol',
  projectPath: process.cwd(),
});

const result = await builder.generate('Create a weather agent with a typed forecast tool.');
console.log(result.text);

Workflows

agentBuilderWorkflows, agentBuilderTemplateWorkflow, workflowBuilderWorkflow and planningAndApprovalWorkflow are shared objects, created once when the package loads. A workflow uses the storage, logger and agents of the last Mastra instance that registered it, and keeps its unfinished runs in memory. Share them only in a process with a single Mastra instance.

When one process runs several Mastra instances, such as one per tenant or per test, give each instance its own set with createAgentBuilderWorkflows():

import { createAgentBuilderWorkflows } from '@mastra/agent-builder';
import { Mastra } from '@mastra/core';

const mastra = new Mastra({ workflows: createAgentBuilderWorkflows() });

createAgentBuilderTemplateWorkflow(), createWorkflowBuilderWorkflow() and createPlanningAndApprovalWorkflow() build a single new workflow. The agent-builder routes in @mastra/server already create one set per instance.

Documentation

AgentBuilder extends Mastra's Agent with defaults intended for code generation. It can inspect an existing project, summarize available tools, write generated files to disk, and keep long builder sessions within the model's token limits.

The constructor accepts the primary model, an optional summaryModel, and the target projectPath. It configures memory and builder-oriented processors internally, then applies deterministic generation defaults for multi-step code changes.

This package is intended for the Mastra Agent Builder product rather than as a stable general-purpose public API. Production use of the Agent Builder experience is subject to the Mastra Enterprise License.

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.