@mastra/agent-builder 0.0.0-experimental-agent-builder-20250815195917
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE.md +15 -0
- package/README.md +109 -0
- package/dist/_tsup-dts-rollup.d.cts +13109 -0
- package/dist/_tsup-dts-rollup.d.ts +13109 -0
- package/dist/index.cjs +3772 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3770 -0
- package/eslint.config.js +11 -0
- package/integration-tests/CHANGELOG.md +20 -0
- package/integration-tests/README.md +154 -0
- package/integration-tests/docker-compose.yml +39 -0
- package/integration-tests/package.json +38 -0
- package/integration-tests/src/agent-template-behavior.test.ts +103 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/env.example +6 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/package.json +17 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/src/mastra/agents/weather.ts +34 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/src/mastra/index.ts +15 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/src/mastra/mcp/index.ts +46 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/src/mastra/tools/weather.ts +13 -0
- package/integration-tests/src/fixtures/minimal-mastra-project/tsconfig.json +17 -0
- package/integration-tests/src/template-integration.test.ts +312 -0
- package/integration-tests/tsconfig.json +13 -0
- package/integration-tests/vitest.config.ts +17 -0
- package/package.json +62 -0
- package/src/agent-builder.test.ts +291 -0
- package/src/defaults.ts +2728 -0
- package/src/index.ts +187 -0
- package/src/processors/tool-summary.ts +136 -0
- package/src/processors/write-file.ts +17 -0
- package/src/types.ts +120 -0
- package/src/utils.ts +133 -0
- package/src/workflows/index.ts +1541 -0
- package/tsconfig.json +5 -0
- package/vitest.config.ts +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @mastra/agent-builder
|
|
2
|
+
|
|
3
|
+
## 0.0.0-experimental-agent-builder-20250815195917
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8e59433]
|
|
8
|
+
- Updated dependencies [49281f5]
|
|
9
|
+
- Updated dependencies [6faaee5]
|
|
10
|
+
- Updated dependencies [4232b14]
|
|
11
|
+
- Updated dependencies [6720c51]
|
|
12
|
+
- Updated dependencies [2256977]
|
|
13
|
+
- Updated dependencies [c597dc5]
|
|
14
|
+
- Updated dependencies [a722c0b]
|
|
15
|
+
- Updated dependencies [c30bca8]
|
|
16
|
+
- Updated dependencies [7444737]
|
|
17
|
+
- Updated dependencies [83d180b]
|
|
18
|
+
- Updated dependencies [3b5fec7]
|
|
19
|
+
- @mastra/core@0.0.0-experimental-agent-builder-20250815195917
|
|
20
|
+
- @mastra/mcp@0.0.0-experimental-agent-builder-20250815195917
|
|
21
|
+
- @mastra/memory@0.0.0-experimental-agent-builder-20250815195917
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Apache License 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Kepler Software, Inc.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# @mastra/agent-builder
|
|
2
|
+
|
|
3
|
+
A specialized AI agent for building production-ready Mastra applications, agents, tools, and workflows from natural language requirements.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mastra/agent-builder
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Overview
|
|
12
|
+
|
|
13
|
+
`@mastra/agent-builder` is a meta-agent that helps developers create Mastra applications by:
|
|
14
|
+
|
|
15
|
+
- **Agent Generation**: Create specialized AI agents from natural language descriptions
|
|
16
|
+
- **Tool Creation**: Generate custom tools with proper schemas and validation
|
|
17
|
+
- **Workflow Building**: Design and implement complex multi-step workflows
|
|
18
|
+
- **Project Management**: Handle dependencies, configuration, and project structure
|
|
19
|
+
- **Code Validation**: Ensure generated code follows best practices and passes linting
|
|
20
|
+
|
|
21
|
+
## Key Features
|
|
22
|
+
|
|
23
|
+
- **Mastra Expert Knowledge**: Deep understanding of Mastra patterns and conventions
|
|
24
|
+
- **Production-Ready Code**: Generates complete, working implementations
|
|
25
|
+
- **Project Context Aware**: Understands existing codebase structure and integrates seamlessly
|
|
26
|
+
- **Quality Assurance**: Built-in validation and testing capabilities
|
|
27
|
+
- **MCP Integration**: Leverages Model Context Protocol for enhanced tooling
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { AgentBuilder } from '@mastra/agent-builder';
|
|
33
|
+
import { openai } from '@ai-sdk/openai';
|
|
34
|
+
|
|
35
|
+
const builder = new AgentBuilder({
|
|
36
|
+
model: openai('gpt-4'),
|
|
37
|
+
summaryModel: openai('gpt-4'),
|
|
38
|
+
projectPath: '/path/to/your/project',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Generate an agent from natural language
|
|
42
|
+
const result = await builder.generateAgent(
|
|
43
|
+
'Create a weather agent that can get current weather and suggest activities',
|
|
44
|
+
);
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
The AgentBuilder requires a configuration object with:
|
|
50
|
+
|
|
51
|
+
- `model`: The primary language model for code generation
|
|
52
|
+
- `summaryModel`: A model for summarizing tool calls and results
|
|
53
|
+
- `projectPath`: Path to your Mastra project
|
|
54
|
+
- `instructions`: Optional additional instructions
|
|
55
|
+
- `tools`: Optional additional tools to include
|
|
56
|
+
|
|
57
|
+
## Advanced Usage
|
|
58
|
+
|
|
59
|
+
### Custom Project Management
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// Install packages
|
|
63
|
+
await builder.tools.manageProject({
|
|
64
|
+
action: 'install',
|
|
65
|
+
packages: [{ name: '@mastra/workflows', version: 'latest' }],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Validate generated code
|
|
69
|
+
await builder.tools.validateCode({
|
|
70
|
+
validationType: ['types', 'lint'],
|
|
71
|
+
files: ['src/agents/my-agent.ts'],
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Server Management
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Start development server
|
|
79
|
+
await builder.tools.manageServer({
|
|
80
|
+
action: 'start',
|
|
81
|
+
port: 4200,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// Test API endpoints
|
|
85
|
+
await builder.tools.httpRequest({
|
|
86
|
+
method: 'GET',
|
|
87
|
+
url: '/health',
|
|
88
|
+
baseUrl: 'http://localhost:4200',
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Memory and Processing
|
|
93
|
+
|
|
94
|
+
The AgentBuilder includes specialized memory processors:
|
|
95
|
+
|
|
96
|
+
- **ToolSummaryProcessor**: Caches and summarizes tool call results
|
|
97
|
+
- **WriteToDiskProcessor**: Saves conversation history for debugging
|
|
98
|
+
- **TokenLimiter**: Manages context window size
|
|
99
|
+
|
|
100
|
+
## Best Practices
|
|
101
|
+
|
|
102
|
+
1. **Provide Clear Requirements**: The more specific your requirements, the better the generated code
|
|
103
|
+
2. **Use Project Context**: Let the agent explore your existing codebase structure
|
|
104
|
+
3. **Validate Output**: Always run the validation tools after code generation
|
|
105
|
+
4. **Iterative Development**: Start with simple agents and add complexity incrementally
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
Apache-2.0
|