Back to prompt library
Mastra AI Agent System Setup
Linked challenge: Accelerated Code Dev & Review Agent
Prompt source
planning17 lines5 sectionsNo variables1 code block
Initialize a Mastra AI project. Define two agents: a 'CodeGenerator' agent and a 'CodeReviewer' agent. The CodeGenerator should use Claude Sonnet 4 and be equipped with tools to write files to a simulated filesystem. The CodeReviewer should use Llama 3 8B Instruct (via a custom tool calling Hugging Face Inference Endpoints) and tools to read files and provide feedback. Outline their initial roles and a simple interaction flow for generating a function and getting it reviewed.
```typescript
import { createAgent, createTool, Workflow } from '@mastra-ai/core';
const codeGenerator = createAgent({
id: 'code-generator',
model: 'claude-sonnet-4',
// ... other configs
});
const codeReviewer = createAgent({
id: 'code-reviewer',
model: 'llama-3-8b-instruct-hf-endpoint', // Placeholder for custom endpoint
// ... other configs
});
// Define a workflow
const workflow = new Workflow();
// ... Add steps for agents to interact
```