-
Notifications
You must be signed in to change notification settings - Fork 5
Add Mastra supervisor agent wrapper #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Mastra supervisor agent wrapper #46
Conversation
- Convert Mastra supervisor agent example to Agentuity format - Preserve all original framework functionality and patterns - Implement three-agent coordination (copywriter, editor, publisher) - Add copywriter tool following Mastra createTool pattern - Include welcome function with example prompts - Follow established Agentuity wrapper conventions - Add comprehensive README and configuration files Follows the original Mastra supervisor agent from: https://mastra.ai/en/examples/agents/supervisor-agent Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
WalkthroughAdds a new Mastra supervisor agent project for Agentuity: config, tooling, lint/format settings, entrypoint, README, cursor rules, a Mastra-based orchestrating agent that coordinates copywriter/editor/publisher sub-agents, and a copywriter tool using Anthropic; includes TypeScript config, package metadata, and ignore rules. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Agentuity as Agentuity Runtime
participant Supervisor as Mastra Supervisor Agent
participant Publisher as Publisher Agent
participant Tool as copywriterTool
participant Copywriter as Copywriter Agent
participant Editor as Editor Agent
User->>Agentuity: HTTP request (topic)
Agentuity->>Supervisor: AgentRequest + Context
Supervisor->>Publisher: generate("Create a blog post about <topic>", maxSteps=5)
rect rgb(240, 248, 255)
note right of Publisher: Orchestration / tool invocation
Publisher->>Tool: invoke({ topic })
Tool->>Copywriter: generate("Create a blog post about <topic>")
Copywriter-->>Tool: { text }
Tool-->>Publisher: { copy }
Publisher->>Editor: refine(copy)
Editor-->>Publisher: polished copy
end
Publisher-->>Supervisor: result text
Supervisor-->>Agentuity: resp.text(result)
Agentuity-->>User: 200 OK (final content)
alt Error path
Supervisor-->>Agentuity: resp.text("An error occurred...")
Agentuity-->>User: 500/handled message
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing touches
🧪 Generate unit tests
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 8
🧹 Nitpick comments (18)
frameworks/mastra/supervisor-agent/.gitignore (1)
1-9: Consider ignoring transient TS/build artifacts.Add coverage/ and TS incremental files to avoid accidental check-ins.
Apply this diff:
node_modules/ dist/ .env .env.local .env.production.local .env.development.local *.log .DS_Store .agentuity/ +coverage/ +*.tsbuildinfoframeworks/mastra/supervisor-agent/tsconfig.json (3)
12-12: Remove JSX setting if no TSX/React is used.This is a server-side agent package; JSX is unnecessary unless you actually ship TSX.
Apply this diff:
- "jsx": "react-jsx",
13-17: Tighten type safety for ESM and optionals.Recommend enabling verbatim ESM and exact optional types.
Apply this diff:
"strict": true, + "verbatimModuleSyntax": true, + "exactOptionalPropertyTypes": true,
19-20: Remove unused TSX include from tsconfig
No.tsxfiles detected (fd -e tsxreturned 0); narrow theincludeto.tsonly.
frameworks/mastra/supervisor-agent/tsconfig.json- "include": ["**/*.ts", "**/*.tsx"], + "include": ["**/*.ts"],frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdc (2)
2-5: Minor cleanup: trailing space and consistency.Trim trailing space on Line 4.
Apply this diff:
globs: "agentuity.yaml" -alwaysApply: true +alwaysApply: true
9-9: Capitalize “Agentuity”.Brand consistency.
Apply this diff:
-This file is used by agentuity to configure the AI Agent project. You should NOT suggest edits to this file. +This file is used by Agentuity to configure the AI Agent project. You should NOT suggest edits to this file.frameworks/mastra/supervisor-agent/package.json (2)
6-13: Consider adding a prepare step for consistent local imports.If you keep main/types pointing to .agentuity, build them automatically.
Apply this diff:
"scripts": { "build": "agentuity build", "dev": "agentuity dev", "format": "biome format --write .", "lint": "biome lint .", + "prepare": "agentuity build", "prestart": "agentuity bundle", "start": "bun run .agentuity/index.js" },
16-19: Declare Bun engine and packageManager for clarity.Improves DX and CI reproducibility.
Apply this diff:
"devDependencies": { "@biomejs/biome": "^1.9.4", "@types/bun": "^1.2.13" }, + "engines": { + "bun": ">=1.1.0" + }, + "packageManager": "bun@1", "peerDependencies": { "typescript": "^5" },Also applies to: 21-21
frameworks/mastra/supervisor-agent/biome.json (1)
22-29: Optional: enable recommended rules; keep custom overrides.Gives you safer defaults with minimal noise.
Apply this diff:
"rules": { - "recommended": false, + "recommended": true, "correctness": { "noUnusedVariables": "error" }, "style": { "useImportType": "error" }frameworks/mastra/supervisor-agent/.cursorrules/agent.mdc (2)
9-15: Tighten wording and casing; fix “node_modules” reference.Minor clarity and consistency tweaks.
- - Prefer loading types from the node modules package `@agentuity/sdk` in the node_modules folder - - The file should export a default function - - Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description - - All code should be in Typescript format - - Use the provided logger from the `AgentContext` interface such as `ctx.logger.info("my message: %s", "hello")` + - Import types from `@agentuity/sdk` (installed in `node_modules`). + - Export a default async function. + - Name the default function `Agent` or the agent’s name, based on context. + - Use TypeScript. + - Use the provided logger from `AgentContext`, e.g., `ctx.logger.info("my message: %s", "hello")`.
18-24: Show logger usage in the example.Add a single info log to reinforce best practice.
export default async function Agent(req: AgentRequest, resp: AgentResponse, ctx: AgentContext) { - return resp.json({"hello":"world"}); + ctx.logger.info("Example Agent invoked"); + return resp.json({ hello: "world" }); }frameworks/mastra/supervisor-agent/README.md (2)
17-22: Bullet punctuation/readability nits.Use consistent bullet formatting; remove mid-sentence hyphens flagged by the linter.
- - Multi-agent coordination using Mastra's Agent class - - Tool integration with the copywriter tool - - Error handling with structured logging - - Welcome function with example prompts - - Follows Agentuity conventions for framework wrappers + - Multi-agent coordination using Mastra’s Agent class + - Tool integration (copywriter tool) + - Structured error handling and logging + - Welcome function with example prompts + - Agentuity-conformant framework wrapper
40-49: Add env var prerequisites for local runs.Small addition improves first-run success.
bun install # Start development server agentuity dev # Build the project agentuity build + +# Prerequisites +# Set your provider keys before running: +# export OPENAI_API_KEY=... # if using OpenAI models +# export ANTHROPIC_API_KEY=... # if using Anthropic modelsframeworks/mastra/supervisor-agent/src/tools/copywriter.ts (2)
19-20: Model ID: prefer a stable alias or confirm snapshot is supported by your SDK.
claude-3-5-sonnet-20241022is valid, andclaude-3-5-sonnet-latestalias exists. If you don’t need a pinned snapshot, consider the-latestalias to reduce churn; otherwise keep the date-pinned version. (docs.anthropic.com, vercel.com)- model: anthropic("claude-3-5-sonnet-20241022"), + model: anthropic("claude-3-5-sonnet-latest"),
15-29: Optional: reuse a registered agent instead of constructing a new one per tool call.Using
mastra.getAgent("copywriterAgent")aligns with Mastra examples and centralizes config/telemetry. If not registered, fall back to the locally constructed agent. (mastra.ai)Example:
execute: async ({ context, mastra }) => { const agent = mastra?.getAgent?.("copywriterAgent") ?? new Agent({ name: "copywriter-agent", instructions: "You are a copywriter agent that writes blog post copy.", model: anthropic("claude-3-5-sonnet-latest"), }); const result = await agent.generate(`Create a blog post about ${context.topic}`); return { copy: result.text }; }frameworks/mastra/supervisor-agent/index.ts (1)
1-1: Safer re-export path.Dropping the explicit
/indexavoids ESM resolution pitfalls post-build and keeps TS barrel-style import. Low risk if your bundler rewrites anyway.-export { default } from "./src/agents/mastra-supervisor-agent/index"; +export { default } from "./src/agents/mastra-supervisor-agent";frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts (2)
22-23: Harden topic extraction.Guard against body read errors/empty strings; keep the same behavior.
- const topic = await req.data.text() ?? "artificial intelligence"; + const topic = (await req.data.text().catch(() => ""))?.trim() || "artificial intelligence";
24-30: Add an entry log for observability.Log the resolved topic before orchestration.
try { + ctx.logger.info("Supervisor starting for topic=%s", topic); const copywriterAgent = new Agent({
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (11)
frameworks/mastra/supervisor-agent/.cursorrules/agent.mdc(1 hunks)frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdc(1 hunks)frameworks/mastra/supervisor-agent/.gitignore(1 hunks)frameworks/mastra/supervisor-agent/README.md(1 hunks)frameworks/mastra/supervisor-agent/agentuity.yaml(1 hunks)frameworks/mastra/supervisor-agent/biome.json(1 hunks)frameworks/mastra/supervisor-agent/index.ts(1 hunks)frameworks/mastra/supervisor-agent/package.json(1 hunks)frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts(1 hunks)frameworks/mastra/supervisor-agent/src/tools/copywriter.ts(1 hunks)frameworks/mastra/supervisor-agent/tsconfig.json(1 hunks)
🧰 Additional context used
🧠 Learnings (51)
📓 Common learnings
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/mastra/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:15:21.314Z
Learning: For best practices in Agentuity SDK projects, use TypeScript for type safety, import types from agentuity/sdk, use structured error handling with try/catch, leverage the provided logger, use storage APIs for data persistence, and consider agent communication for complex workflows.
Learnt from: CR
PR: agentuity/examples#0
File: agents/Startup_News_Scraper/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:39:11.850Z
Learning: Applies to agents/Startup_News_Scraper/src/agents/**/*.ts : Import types from `agentuity/sdk`
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/vercel/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:16:49.315Z
Learning: When writing an Agent in TypeScript for Agentuity, always use the types provided by the `agentuity/sdk` package for AgentRequest, AgentResponse, and AgentContext to ensure type safety and compatibility.
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:39:44.988Z
Learning: Applies to agents/composio/src/agents/**/*.ts : Import types from `agentuity/sdk`
📚 Learning: 2025-07-17T13:38:58.657Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/Startup_News_Scraper/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:38:58.657Z
Learning: Applies to agents/Startup_News_Scraper/**/src/agents/**/index.ts : Prefer loading types from the node modules package `agentuity/sdk` in the node_modules folder
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-07-17T13:39:18.709Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:18.709Z
Learning: Applies to agents/agent-riza/**/src/agents/**/index.ts : Prefer loading types from the node modules package `agentuity/sdk` in the node_modules folder
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-07-17T13:39:37.133Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:37.133Z
Learning: Applies to agents/composio/**/src/agents/**/index.ts : Prefer loading types from the node modules package `agentuity/sdk` in the node_modules folder
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-07-17T13:40:37.445Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:40:37.445Z
Learning: Applies to agentuity/sdk-js/streaming/**/src/agents/**/index.ts : Prefer loading types from the node modules package `agentuity/sdk` in the node_modules folder
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-07-17T13:39:55.775Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:55.775Z
Learning: Applies to agents/deep-research-js/**/src/agents/**/index.ts : Prefer loading types from the node modules package `agentuity/sdk` in the node_modules folder
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-06-23T17:15:12.561Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/mastra/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:15:12.561Z
Learning: In Agentuity AI Agent files (`**/src/agents/**/index.ts`), import types such as `AgentRequest`, `AgentResponse`, and `AgentContext` from the `agentuity/sdk` package to ensure type safety and consistency.
Applied to files:
frameworks/mastra/supervisor-agent/package.jsonframeworks/mastra/supervisor-agent/.cursorrules/agent.mdcframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:11.850Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/Startup_News_Scraper/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:39:11.850Z
Learning: Applies to agents/Startup_News_Scraper/src/agents/**/*.ts : Import types from `agentuity/sdk`
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-07-17T13:39:44.988Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:39:44.988Z
Learning: Applies to agents/composio/src/agents/**/*.ts : Import types from `agentuity/sdk`
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-06-23T17:17:19.027Z
Learnt from: CR
PR: agentuity/examples#0
File: patterns/llmAsJury/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:17:19.027Z
Learning: Use TypeScript for better type safety and IDE support when developing with the Agentuity SDK.
Applied to files:
frameworks/mastra/supervisor-agent/package.json
📚 Learning: 2025-07-17T13:39:37.133Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:37.133Z
Learning: Applies to agents/composio/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:55.775Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:55.775Z
Learning: Applies to agents/deep-research-js/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:18.709Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:18.709Z
Learning: Applies to agents/agent-riza/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:40:37.445Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:40:37.445Z
Learning: Applies to agentuity/sdk-js/streaming/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:38:58.657Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/Startup_News_Scraper/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:38:58.657Z
Learning: Applies to agents/Startup_News_Scraper/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:37.133Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:37.133Z
Learning: Applies to agents/composio/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Applied to files:
frameworks/mastra/supervisor-agent/index.tsframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:18.709Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:18.709Z
Learning: Applies to agents/agent-riza/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Applied to files:
frameworks/mastra/supervisor-agent/index.tsframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:55.775Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:55.775Z
Learning: Applies to agents/deep-research-js/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Applied to files:
frameworks/mastra/supervisor-agent/index.tsframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:40:37.445Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:40:37.445Z
Learning: Applies to agentuity/sdk-js/streaming/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Applied to files:
frameworks/mastra/supervisor-agent/index.tsframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:38:58.657Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/Startup_News_Scraper/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:38:58.657Z
Learning: Applies to agents/Startup_News_Scraper/**/src/agents/**/index.ts : Prefer naming the default function Agent or the name of the Agent based on the context of the Agent description
Applied to files:
frameworks/mastra/supervisor-agent/index.tsframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-06-23T17:14:39.393Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/langgraph/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:14:39.393Z
Learning: In Agentuity AI Agent files (`**/src/agents/**/index.ts`), the default export should be an async function that handles the agent logic, typically accepting parameters `(req: AgentRequest, resp: AgentResponse, ctx: AgentContext)`.
Applied to files:
frameworks/mastra/supervisor-agent/index.tsframeworks/mastra/supervisor-agent/.cursorrules/agent.mdcframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:44.988Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:39:44.988Z
Learning: Applies to agents/composio/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.json
📚 Learning: 2025-07-17T13:39:37.133Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:37.133Z
Learning: Applies to agents/composio/**/src/agents/**/index.ts : All code should be in Typescript format
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.json
📚 Learning: 2025-07-17T13:39:31.143Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:39:31.143Z
Learning: Applies to agents/agent-riza/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.jsonframeworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-07-17T13:40:50.861Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:40:50.861Z
Learning: Applies to agentuity/sdk-js/streaming/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.json
📚 Learning: 2025-07-17T13:39:18.709Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:18.709Z
Learning: Applies to agents/agent-riza/**/src/agents/**/index.ts : All code should be in Typescript format
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.jsonframeworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-07-17T13:40:05.817Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-07-17T13:40:05.817Z
Learning: Applies to agents/deep-research-js/src/agents/**/*.ts : Use TypeScript for better type safety and IDE support
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.json
📚 Learning: 2025-07-17T13:39:55.775Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:55.775Z
Learning: Applies to agents/deep-research-js/**/src/agents/**/index.ts : All code should be in Typescript format
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.jsonframeworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-07-17T13:40:37.445Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:40:37.445Z
Learning: Applies to agentuity/sdk-js/streaming/**/src/agents/**/index.ts : All code should be in Typescript format
Applied to files:
frameworks/mastra/supervisor-agent/tsconfig.json
📚 Learning: 2025-06-23T17:16:16.519Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:16:16.519Z
Learning: The Agentuity configuration file (agentuity.yaml) is reserved for configuring the AI Agent project and should not be edited or suggested for edits during code review.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-07-17T13:41:01.314Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/agno/from_agno/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:41:01.314Z
Learning: Applies to frameworks/agno/from_agno/**/agentuity.yaml : Do not suggest edits to the Agentuity AI Configuration file (agentuity.yaml)
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:16:33.550Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/pydantic/basic/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:16:33.550Z
Learning: The agentuity.yaml file is a configuration file used by Agentuity to configure the AI Agent project and should not be edited or suggested for edits during code review.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:13:52.368Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/crewai/socialagent/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:13:52.368Z
Learning: The 'agentuity.yaml' file is a configuration file used by Agentuity to configure the AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-07-17T13:39:39.665Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:39:39.665Z
Learning: Applies to agents/composio/**/agentuity.yaml : Do NOT suggest edits to the Agentuity AI Configuration file (agentuity.yaml)
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:15:46.735Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/miscellaneous/mem0/mem0demo/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:15:46.735Z
Learning: The Agentuity configuration file (agentuity.yaml) is used to configure the AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:14:18.092Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/langchain/basic/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:14:18.092Z
Learning: The file 'agentuity.yaml' is used to configure the Agentuity AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:16:02.063Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai-typescript/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:16:02.063Z
Learning: The Agentuity AI Configuration file (agentuity.yaml) is used to configure the AI Agent project and should not be edited or suggested for edits.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-07-17T13:39:23.010Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:39:23.010Z
Learning: Applies to agents/agent-riza/**/agentuity.yaml : Do not suggest edits to the Agentuity AI Configuration file (agentuity.yaml)
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdc
📚 Learning: 2025-07-17T13:40:15.104Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/tavily_agent/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:40:15.104Z
Learning: Applies to agents/tavily_agent/**/agentuity.yaml : Do not suggest edits to the Agentuity AI Configuration file (agentuity.yaml)
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdc
📚 Learning: 2025-06-23T17:15:30.804Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/miscellaneous/grokLiveSearch/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:15:30.804Z
Learning: In the context of Agentuity AI projects, the 'agentuity.yaml' file is a configuration file that should not be edited or suggested for edits during code review.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:17:12.992Z
Learnt from: CR
PR: agentuity/examples#0
File: patterns/llmAsJury/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-06-23T17:17:12.992Z
Learning: In the context of Agentuity AI projects, the agentuity.yaml file is a configuration file that should not be edited or suggested for edits during code review.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agentuity.mdcframeworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:15:59.829Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai-typescript/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:15:59.829Z
Learning: In TypeScript AI Agent files located at '**/src/agents/**/index.ts', use the provided logger from the `AgentContext` interface (e.g., `ctx.logger.info(...)`) for logging, rather than custom or external logging solutions.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-06-23T17:17:10.338Z
Learnt from: CR
PR: agentuity/examples#0
File: patterns/llmAsJury/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:17:10.338Z
Learning: In TypeScript AI Agent files located at '**/src/agents/**/index.ts', always use the provided logger from the `AgentContext` interface (e.g., `ctx.logger.info(...)`) for logging, rather than custom logging solutions.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-06-23T17:14:39.393Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/langgraph/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:14:39.393Z
Learning: In Agentuity AI Agent files (`**/src/agents/**/index.ts`), always use the provided logger from the `AgentContext` interface (e.g., `ctx.logger.info(...)`) for logging, rather than custom or external logging solutions.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-06-23T17:16:49.315Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/vercel/basic/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-06-23T17:16:49.315Z
Learning: When writing an Agent in TypeScript for Agentuity, always use the types provided by the `agentuity/sdk` package for AgentRequest, AgentResponse, and AgentContext to ensure type safety and compatibility.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agent.mdcframeworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-06-23T17:15:21.314Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/mastra/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:15:21.314Z
Learning: For best practices in Agentuity SDK projects, use TypeScript for type safety, import types from agentuity/sdk, use structured error handling with try/catch, leverage the provided logger, use storage APIs for data persistence, and consider agent communication for complex workflows.
Applied to files:
frameworks/mastra/supervisor-agent/.cursorrules/agent.mdc
📚 Learning: 2025-07-17T13:41:25.437Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/crewai/basic/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:41:25.437Z
Learning: Applies to frameworks/crewai/basic/**/agentuity.yaml : Do not suggest edits to the agentuity.yaml configuration file
Applied to files:
frameworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-07-17T13:39:58.483Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agentuity.mdc:0-0
Timestamp: 2025-07-17T13:39:58.483Z
Learning: Applies to agents/deep-research-js/**/agentuity.yaml : Do not suggest edits to the agentuity.yaml configuration file
Applied to files:
frameworks/mastra/supervisor-agent/agentuity.yaml
📚 Learning: 2025-06-23T17:14:46.802Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/langgraph/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:14:46.802Z
Learning: The Agentuity JavaScript SDK provides core interfaces such as AgentHandler, AgentRequest, AgentResponse, and AgentContext for building AI agents in TypeScript or JavaScript.
Applied to files:
frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-06-23T17:15:21.314Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/mastra/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:15:21.314Z
Learning: In the Agentuity JavaScript SDK, the main handler for an agent should implement the AgentHandler type: a function that takes (request: AgentRequest, response: AgentResponse, context: AgentContext) and returns a Promise of AgentResponseType.
Applied to files:
frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
📚 Learning: 2025-06-23T17:16:58.079Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/vercel/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:16:58.079Z
Learning: In the Agentuity JavaScript SDK, the main handler for an agent should implement the AgentHandler type: (request: AgentRequest, response: AgentResponse, context: AgentContext) => Promise<AgentResponseType>.
Applied to files:
frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
🪛 LanguageTool
frameworks/mastra/supervisor-agent/README.md
[grammar] ~17-~17: There might be a mistake here.
Context: ... coordination using Mastra's Agent class - Tool integration with the copywriter too...
(QB_NEW_EN)
[grammar] ~18-~18: There might be a mistake here.
Context: ...ool integration with the copywriter tool - Error handling with structured logging -...
(QB_NEW_EN)
[grammar] ~19-~19: There might be a mistake here.
Context: ...- Error handling with structured logging - Welcome function with example prompts - ...
(QB_NEW_EN)
[grammar] ~20-~20: There might be a mistake here.
Context: ... - Welcome function with example prompts - Follows Agentuity conventions for framew...
(QB_NEW_EN)
[grammar] ~29-~29: There might be a mistake here.
Context: ...generate initial content 3. Coordinates with editor agent for refinement 4. Returns ...
(QB_NEW_EN)
[grammar] ~55-~55: There might be a mistake here.
Context: ...riginal Mastra imports and Agent classes - Maintains framework-specific tool patter...
(QB_NEW_EN)
[grammar] ~56-~56: There might be a mistake here.
Context: ...intains framework-specific tool patterns - Wraps the workflow in Agentuity's reques...
(QB_NEW_EN)
[grammar] ~57-~57: There might be a mistake here.
Context: ...n Agentuity's request/response structure - Includes proper error handling and loggi...
(QB_NEW_EN)
[grammar] ~58-~58: There might be a mistake here.
Context: ...cludes proper error handling and logging
(QB_NEW_EN)
🔇 Additional comments (9)
frameworks/mastra/supervisor-agent/.gitignore (1)
1-9: Good baseline ignore set.Covers deps, build outputs, local env, logs, macOS junk, and Agentuity artifacts.
frameworks/mastra/supervisor-agent/tsconfig.json (1)
17-17: Bun types are configured; devDep present. LGTM.frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts (2)
44-47:maxStepsusage is correct.Mastra supports
maxStepsingenerate; default is 1, so setting 5 is appropriate for tool-using workflows. (mastra.ai)
28-41: Confirm OpenAI model IDs against your AI SDK version.
openai("gpt-4o")is commonly accepted, but model aliases can drift between SDK versions. Verify against your installed@ai-sdk/openaidocs, or pin a dated snapshot if needed.Run-time check suggestion: try a quick one-off dev call with the same SDK to ensure the model name is recognized.
frameworks/mastra/supervisor-agent/agentuity.yaml (5)
1-7: Header and schema look good.
No actionable issues. The file is clearly marked as generated; proceeding without suggesting edits.
9-9: Ensure Agentuity CLI (>=0.0.130) is installed locally and in CI
The verification script did not detect a local agentuity CLI; install or update it to ≥0.0.130 in both developer environments and CI pipelines to prevent build/runtime failures.
49-55: Verify resource budgets under realistic load. The configured limits (memory: 250 Mi, CPU: 500 m, disk: 100 Mi) may be tight when multiple models or tools load or if logs spike. Smoke-test headroom under realistic workloads in staging.
34-47: Deployment flags: manually verify Bun supports all specified runtime flags. Check the Bun version installed in CI (e.g. from your bun.lockb header or thesetup-bunaction) to confirm support for the Node-centric flags (--no-addons,--no-deprecation,--no-global-search-paths, etc.).
57-67: Adjust bundler ignore patterns to whitelist your agents
The currentignore: src/**rule will exclude everything undersrc/agents. Update the ignore list to whitelist that directory before excludingsrc/**, for example:ignore: - node_modules/** - dist/** - '!src/agents/**' - src/**⛔ Skipped due to learnings
Learnt from: CR PR: agentuity/examples#0 File: agents/deep-research-js/.cursor/rules/agentuity.mdc:0-0 Timestamp: 2025-07-17T13:39:58.483Z Learning: Applies to agents/deep-research-js/**/agentuity.yaml : Do not suggest edits to the agentuity.yaml configuration file
| development: | ||
| # The port to run the development server on which can be overridden by setting the PORT environment variable | ||
| port: 3500 | ||
| watch: | ||
| # Whether to watch for changes and automatically restart the server | ||
| enabled: true | ||
| # Rules for files to watch for changes | ||
| files: | ||
| - src/** | ||
| # The command to run the development server | ||
| command: bun | ||
| # The arguments to pass to the development server | ||
| args: | ||
| - run | ||
| - --silent | ||
| - .agentuity/index.js | ||
| deployment: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Dev command/entrypoint: validate .agentuity/index.js generation and Bun availability.
Dev server points to .agentuity/index.js via bun run; confirm bun is available and the bundler emits this entry before starting dev.
🏁 Script executed:
#!/bin/bash
# Check Bun availability and version
command -v bun >/dev/null 2>&1 && bun --version || echo "Bun not found"
# Ensure the generated entry exists after build (or dev prepare step)
fd -a '.agentuity/index.js' -u || echo "Missing .agentuity/index.js (run agentuity build/dev first?)"Length of output: 84
Require Bun and generated entry for dev
frameworks/mastra/supervisor-agent/agentuity.yaml:17-33 uses bun run .agentuity/index.js; ensure:
bunis installed (or surface a clear error/fallback if missing).agentuity/index.jsis generated before dev (add a prestart/build step or document this prerequisite)
🤖 Prompt for AI Agents
frameworks/mastra/supervisor-agent/agentuity.yaml lines 17-33: the dev command
uses `bun run .agentuity/index.js` but does not ensure bun is available nor that
the generated entry `.agentuity/index.js` exists; update the dev workflow to
first verify `bun` is installed (or print a clear error and exit/fallback to
node/npm/yarn), and ensure the entry is generated before starting by adding a
prestart/build step that runs the generator/compile task (or document this
prerequisite clearly in README and add a prestart command in the YAML that runs
the build step and fails with a helpful message if the generated file is
missing).
| agents: | ||
| - # The ID of the Agent which is automatically generated | ||
| id: agent_mastra_supervisor_agent | ||
| # The name of the Agent which is editable | ||
| name: mastra-supervisor-agent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Agent registry: ensure ID/name map to the implementation.
Confirm the code registers/exports an agent named "mastra-supervisor-agent" and (if applicable) references id "agent_mastra_supervisor_agent".
If any verification fails, I can help trace the bundling/registry path and propose fixes in code (outside YAML).
🏁 Script executed:
#!/bin/bash
# Look for agent name/ID in source
rg -nP '\bmastra-supervisor-agent\b|\bagent_mastra_supervisor_agent\b' -S --type=tsLength of output: 201
Agent registry mapping: missing reference to agent ID
- Name mapping is correct (
export { default } from "./src/agents/mastra-supervisor-agent/index";), but no occurrences ofagent_mastra_supervisor_agentwere found in the codebase. Ensure the agent’s ID is registered or referenced in the implementation (e.g. passed to the registry or constructor).
🤖 Prompt for AI Agents
In frameworks/mastra/supervisor-agent/agentuity.yaml around lines 69 to 73, the
agent ID agent_mastra_supervisor_agent is declared in the YAML but not
referenced anywhere in code; update the agent implementation to register or
reference this exact ID (for example, pass agent_mastra_supervisor_agent into
the agent registry/constructor where agents are registered, or add it to the
export/registration map used by the loader) so the YAML ID and the runtime
registration match exactly.
| "vcs": { | ||
| "enabled": false, | ||
| "clientKind": "git", | ||
| "useIgnoreFile": false | ||
| }, | ||
| "files": { | ||
| "ignoreUnknown": false, | ||
| "ignore": [] | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Biome is not honoring .gitignore; may format build artifacts.
With useIgnoreFile=false and empty ignore list, .agentuity/, dist/, node_modules/ could be linted/formatted.
Apply this diff:
"vcs": {
- "enabled": false,
- "clientKind": "git",
- "useIgnoreFile": false
+ "enabled": true,
+ "clientKind": "git",
+ "useIgnoreFile": true
},
"files": {
- "ignoreUnknown": false,
- "ignore": []
+ "ignoreUnknown": false,
+ "ignore": [".agentuity/**", "dist/**", "node_modules/**"]
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "vcs": { | |
| "enabled": false, | |
| "clientKind": "git", | |
| "useIgnoreFile": false | |
| }, | |
| "files": { | |
| "ignoreUnknown": false, | |
| "ignore": [] | |
| }, | |
| "vcs": { | |
| "enabled": true, | |
| "clientKind": "git", | |
| "useIgnoreFile": true | |
| }, | |
| "files": { | |
| "ignoreUnknown": false, | |
| "ignore": [".agentuity/**", "dist/**", "node_modules/**"] | |
| }, |
🤖 Prompt for AI Agents
In frameworks/mastra/supervisor-agent/biome.json around lines 3 to 11, Biome is
configured with useIgnoreFile=false and an empty ignore list so build artifacts
and deps may be linted/formatted; change useIgnoreFile to true (so .gitignore is
honored) and/or populate the files.ignore array to include common artifacts such
as ".agentuity/", "dist/", and "node_modules/" so those paths are excluded from
formatting/linting.
| "main": "index.js", | ||
| "type": "module", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Entry points are inconsistent (index.ts vs .agentuity/index.js).
main points to index.js (likely nonexistent) and module points to index.ts (non-standard). Align to the actual bundled output or drop fields to avoid confusion.
Option A (simplest; private package): remove misleading fields.
- "main": "index.js",
- "type": "module",
+ "type": "module",
...
- "module": "index.ts"Option B (align to Agentuity bundle):
- "main": "index.js",
+ "main": ".agentuity/index.js",
+ "types": ".agentuity/index.d.ts",
...
- "module": "index.ts"
+ "module": ".agentuity/index.js"Pick one and ensure .agentuity artifacts exist before consumers import.
Also applies to: 31-31
🤖 Prompt for AI Agents
frameworks/mastra/supervisor-agent/package.json lines 4-5: the package.json
declares inconsistent entry points (main pointing to index.js while source is
index.ts and there's a separate .agentuity bundle) — fix by choosing one
approach: for the simplest/quick fix (recommended for a private package) remove
the misleading "main" and "type" fields (and any "module" entry at line 31) so
consumers don't rely on non-existent artifacts and optionally add "private":
true; alternatively, if you intend to publish or use the Agentuity bundle, set
"main" to ".agentuity/index.js", ensure the build actually emits
.agentuity/index.js, and set "type" to the correct module format that matches
the bundle before committing.
| "dependencies": { | ||
| "@agentuity/sdk": "^0.0.116", | ||
| "@ai-sdk/openai": "^1.2.11", | ||
| "@mastra/core": "^0.9.4", | ||
| "ai": "^4.3.16", | ||
| "mastra": "^0.6.3", | ||
| "zod": "^3.23.8" | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify you truly need both mastra and @mastra/core.
Dual installs can bloat and cause version skew.
Run to confirm imports:
If only one is used, remove the other from dependencies.
🏁 Script executed:
#!/bin/bash
rg -nP -C2 'from\s+[\'"](@mastra/core|mastra)[\'"]' --type ts --type tsxLength of output: 116
🏁 Script executed:
#!/bin/bash
# Verify usage of @mastra/core and mastra packages in TS/JS files
# Search for ES module imports
rg -nP -C2 "import\s+.*\s+from\s+['\"](@mastra/core|mastra)['\"]" --type ts --type tsx .
# Search for CommonJS requires
rg -nP -C2 "require\s*\(\s*['\"](@mastra/core|mastra)['\"]\s*\)" --glob "*.{ts,tsx,js,jsx}"Length of output: 220
🏁 Script executed:
#!/bin/bash
# Retry import search without relying on predefined types
# Search ES module imports in TS/JS/TSX/JSX
rg -nP -C2 "import\s+.*\s+from\s+['\"](@mastra/core|mastra)['\"]" --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx" .
# Search CommonJS requires in same file types
rg -nP -C2 "require\s*\(\s*['\"](@mastra/core|mastra)['\"]\s*\)" --glob "*.ts" --glob "*.tsx" --glob "*.js" --glob "*.jsx" .Length of output: 3090
Remove unused mastra dependency
No code in this package imports from mastra (all Mastra APIs come from @mastra/core), so remove this line from frameworks/mastra/supervisor-agent/package.json:
- "mastra": "^0.6.3",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "dependencies": { | |
| "@agentuity/sdk": "^0.0.116", | |
| "@ai-sdk/openai": "^1.2.11", | |
| "@mastra/core": "^0.9.4", | |
| "ai": "^4.3.16", | |
| "mastra": "^0.6.3", | |
| "zod": "^3.23.8" | |
| }, | |
| "dependencies": { | |
| "@agentuity/sdk": "^0.0.116", | |
| "@ai-sdk/openai": "^1.2.11", | |
| "@mastra/core": "^0.9.4", | |
| "ai": "^4.3.16", | |
| "zod": "^3.23.8" | |
| }, |
🤖 Prompt for AI Agents
frameworks/mastra/supervisor-agent/package.json lines 23-30: the package.json
lists an unused "mastra": "^0.6.3" dependency; remove that "mastra" entry from
the dependencies object and run npm/yarn install (or update lockfile) to ensure
the package tree and lockfile are consistent.
| The agent accepts a topic and coordinates the creation of a blog post through the three-agent workflow: | ||
|
|
||
| 1. Publisher agent receives the topic | ||
| 2. Uses the copywriter tool to generate initial content | ||
| 3. Coordinates with editor agent for refinement | ||
| 4. Returns the final polished content | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Docs claim editor step, but code doesn’t wire an editor tool.
The README describes “Copywriter → Editor → Publisher,” yet the implementation only exposes copywriterTool to the publisher. Either add an editorTool and wire it, or adjust the README.
Would you like a patch to add editorTool and update the publisher to use it?
🏁 Script executed:
#!/bin/bash
# Search for code files in the supervisor agent
echo "Listing TypeScript/JavaScript files under frameworks/mastra/supervisor-agent:"
find frameworks/mastra/supervisor-agent -type f \( -name '*.ts' -o -name '*.js' \)
# Search for wiring of copywriterTool
echo "Occurrences of copywriterTool:"
rg -n 'copywriterTool' frameworks/mastra/supervisor-agent
# Search for wiring of editorTool
echo "Occurrences of editorTool:"
rg -n 'editorTool' frameworks/mastra/supervisor-agent
# Search for generic 'editor' references in code
echo "Occurrences of 'editor' in code:"
rg -n 'editor' frameworks/mastra/supervisor-agentLength of output: 2006
Align README with editor agent usage
README describes an editor tool, but the implementation instantiates an editorAgent directly (index.ts 31–33) and only wires copywriterTool. Update the README to reference the editorAgent step or introduce an editorTool in code.
🧰 Tools
🪛 LanguageTool
[grammar] ~29-~29: There might be a mistake here.
Context: ...generate initial content 3. Coordinates with editor agent for refinement 4. Returns ...
(QB_NEW_EN)
🤖 Prompt for AI Agents
frameworks/mastra/supervisor-agent/README.md lines 25-31: the README calls the
editor an "editor tool" but the implementation actually instantiates an
editorAgent (index.ts lines 31–33) and only wires the copywriterTool; update the
README to accurately describe the workflow by replacing "editor tool" references
with "editor agent" (or explicitly note that the publisher coordinates with an
editorAgent for refinement), or alternatively modify the code to expose an
editorTool and wire it alongside copywriterTool so README and implementation
match.
| const editorAgent = new Agent({ | ||
| name: "editor-agent", | ||
| instructions: "You are an editor agent that refines the content.", | ||
| model: openai("gpt-4o"), | ||
| }); | ||
|
|
||
| const publisherAgent = new Agent({ | ||
| name: "publisher-agent", | ||
| instructions: "You are a publisher agent that supervises and coordinates the other agents.", | ||
| model: openai("gpt-4o"), | ||
| tools: { copywriterTool }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Editor step is not wired; publisher only has copywriterTool.
This breaks the 3-agent flow described in the PR/README. Add an editorTool and expose both tools to the publisher. Mastra expects tools as an object map; that part is correct. (mastra.ai)
- const editorAgent = new Agent({
+ const editorAgent = new Agent({
name: "editor-agent",
instructions: "You are an editor agent that refines the content.",
model: openai("gpt-4o"),
});
- const publisherAgent = new Agent({
+ // Define an editor tool that uses the editor agent
+ // (alternatively, move this to src/tools/editor.ts)
+ const editorTool = {
+ id: "editor-agent",
+ description: "Calls the editor agent to improve blog post copy",
+ inputSchema: z.object({ copy: z.string().describe("Blog post copy") }),
+ outputSchema: z.object({ copy: z.string().describe("Edited blog post copy") }),
+ execute: async ({ context }: { context: { copy: string } }) => {
+ const edited = await editorAgent.generate(
+ `Edit the following blog post. Only return the final edited copy:\n\n${context.copy}`
+ );
+ return { copy: edited.text };
+ },
+ };
+
+ const publisherAgent = new Agent({
name: "publisher-agent",
- instructions: "You are a publisher agent that supervises and coordinates the other agents.",
+ instructions: "You are a publisher agent that first calls the copywriter tool to create copy, then calls the editor tool to refine it. Only return the final edited copy.",
model: openai("gpt-4o"),
- tools: { copywriterTool },
+ tools: { copywriterTool, editorTool },
});Add the necessary imports outside this hunk:
import { z } from "zod";🤖 Prompt for AI Agents
In
frameworks/mastra/supervisor-agent/src/agents/mastra-supervisor-agent/index.ts
around lines 31 to 42, the editor agent isn’t wired and the publisher only has
copywriterTool; create an editorTool (compatible with Mastra tool map), import z
from "zod" at the top of the file, and then add editorTool to the
publisherAgent.tools object so the publisher exposes both { copywriterTool,
editorTool }; ensure the editorAgent is configured to use editorTool where
appropriate.
| @@ -0,0 +1,30 @@ | |||
| import { createTool } from "@mastra/core"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong import: createTool should come from @mastra/core/tools.
This will fail at runtime; the docs import from @mastra/core/tools. (mastra.ai)
-import { createTool } from "@mastra/core";
+import { createTool } from "@mastra/core/tools";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { createTool } from "@mastra/core"; | |
| import { createTool } from "@mastra/core/tools"; |
🤖 Prompt for AI Agents
In frameworks/mastra/supervisor-agent/src/tools/copywriter.ts around line 1 the
import is wrong: replace the import of createTool from "@mastra/core" with the
correct module "@mastra/core/tools" so the runtime resolves the function
correctly; update the import statement to import createTool from
"@mastra/core/tools" and keep any existing named imports/usage unchanged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
♻️ Duplicate comments (1)
frameworks/mastra/supervisor-agent/src/tools/copywriter.ts (1)
1-1: Wrong import source forcreateTool.Per Mastra docs, import from
@mastra/core/tools, not@mastra/core.-import { createTool } from "@mastra/core"; +import { createTool } from "@mastra/core/tools";
🧹 Nitpick comments (3)
frameworks/mastra/supervisor-agent/src/tools/copywriter.ts (3)
6-8: Tool id collides with agent name; rename to avoid confusion/routing conflicts.Using
"copywriter-agent"for a tool id can clash with an agent of the same name.-export const copywriterTool = createTool({ - id: "copywriter-agent", +export const copywriterTool = createTool({ + id: "copywriter-tool",
16-20: Avoid per-invocation agent construction and removeanytyping on model.Hoist the agent to module scope and type the model to the AI SDK interface to cut overhead and keep types sound.
-const copywriterAgent = new Agent({ - name: "copywriter-agent", - instructions: "You are a copywriter agent that writes blog post copy.", - model: anthropic("claude-3-5-sonnet-20241022") as any, -}); +// at module scope (add above the export) +// import type { LanguageModelV1 } from "ai"; +const copywriterAgent = new Agent({ + name: "copywriter-agent", + instructions: "You are a copywriter agent that writes blog post copy.", + model: anthropic("claude-3-5-sonnet-20241022") as LanguageModelV1, +});Module-scope addition (outside the selected lines):
import type { LanguageModelV1 } from "ai";
22-28: Add minimal error handling to surface actionable failures to the supervisor.Wrap
generateto attach context; rethrow to let the orchestrator handle.-const result = await copywriterAgent.generate( - `Create a blog post about ${input.topic}`, -); +let result; +try { + result = await copywriterAgent.generate(`Create a blog post about ${input.topic}`); +} catch (err) { + // Preserve stack while adding context for upstream logs + throw new Error(`copywriter-tool failed for topic "${input.topic}": ${String((err as Error).message)}`); +}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
frameworks/mastra/supervisor-agent/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
frameworks/mastra/supervisor-agent/agentuity.yaml(1 hunks)frameworks/mastra/supervisor-agent/index.ts(1 hunks)frameworks/mastra/supervisor-agent/package.json(1 hunks)frameworks/mastra/supervisor-agent/src/tools/copywriter.ts(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- frameworks/mastra/supervisor-agent/package.json
- frameworks/mastra/supervisor-agent/agentuity.yaml
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/mastra/basic/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:15:21.314Z
Learning: For best practices in Agentuity SDK projects, use TypeScript for type safety, import types from agentuity/sdk, use structured error handling with try/catch, leverage the provided logger, use storage APIs for data persistence, and consider agent communication for complex workflows.
📚 Learning: 2025-07-17T13:39:37.133Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/composio/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:37.133Z
Learning: Applies to agents/composio/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:38:58.657Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/Startup_News_Scraper/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:38:58.657Z
Learning: Applies to agents/Startup_News_Scraper/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:55.775Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/deep-research-js/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:55.775Z
Learning: Applies to agents/deep-research-js/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:39:18.709Z
Learnt from: CR
PR: agentuity/examples#0
File: agents/agent-riza/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:39:18.709Z
Learning: Applies to agents/agent-riza/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
📚 Learning: 2025-07-17T13:40:37.445Z
Learnt from: CR
PR: agentuity/examples#0
File: agentuity/sdk-js/streaming/.cursor/rules/agent.mdc:0-0
Timestamp: 2025-07-17T13:40:37.445Z
Learning: Applies to agentuity/sdk-js/streaming/**/src/agents/**/index.ts : The file should export a default function
Applied to files:
frameworks/mastra/supervisor-agent/index.ts
🔇 Additional comments (2)
frameworks/mastra/supervisor-agent/index.ts (1)
3-5: Action: make dirname usage runtime-safeBun exposes import.meta.dir and provides import.meta.dirname as an alias; Node added import.meta.dirname in v20.11.0 — keep as-is only if this project targets Bun or Node >=20.11; otherwise replace with a portable fallback. (bun.sh)
File: frameworks/mastra/supervisor-agent/index.ts (lines 3-5)
Apply the portable Bun/Node ESM fallback (Option B):
+import { fileURLToPath } from "node:url"; +import { dirname } from "node:path"; + +const __dirname = + typeof (import.meta as any).dir === "string" + ? (import.meta as any).dir + : dirname(fileURLToPath(import.meta.url)); - -runner(true, import.meta.dirname).catch((err) => { +runner(true, __dirname).catch((err) => {frameworks/mastra/supervisor-agent/src/tools/copywriter.ts (1)
6-30: Fix tool input usage and verify callers/imports
- Replace context.topic with input.topic in execute (frameworks/mastra/supervisor-agent/src/tools/copywriter.ts:23).
- Ensure all callers reference the new tool id "copywriter-agent" and pass { topic: string } — repo scan found no invocations.
- Confirm createTool import source — found imports from "@mastra/core" at frameworks/mastra/supervisor-agent/src/tools/copywriter.ts:1 and frameworks/mastra/tool-calling/src/tools/weather.ts:1; update if the export location changed.
| execute: async ({ context }) => { | ||
| const copywriterAgent = new Agent({ | ||
| name: "copywriter-agent", | ||
| instructions: "You are a copywriter agent that writes blog post copy.", | ||
| model: anthropic("claude-3-5-sonnet-20241022") as any, | ||
| }); | ||
|
|
||
| const result = await copywriterAgent.generate( | ||
| `Create a blog post about ${context.topic}`, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: tool reads context.topic; it should read input.topic (per inputSchema).
As written, context.topic will be undefined and the prompt will be malformed.
-execute: async ({ context }) => {
+execute: async ({ input }) => {
const copywriterAgent = new Agent({
name: "copywriter-agent",
instructions: "You are a copywriter agent that writes blog post copy.",
- model: anthropic("claude-3-5-sonnet-20241022") as any,
+ model: anthropic("claude-3-5-sonnet-20241022") as any,
});
- const result = await copywriterAgent.generate(
- `Create a blog post about ${context.topic}`,
- );
+ const result = await copywriterAgent.generate(
+ `Create a blog post about ${input.topic}`,
+ );📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| execute: async ({ context }) => { | |
| const copywriterAgent = new Agent({ | |
| name: "copywriter-agent", | |
| instructions: "You are a copywriter agent that writes blog post copy.", | |
| model: anthropic("claude-3-5-sonnet-20241022") as any, | |
| }); | |
| const result = await copywriterAgent.generate( | |
| `Create a blog post about ${context.topic}`, | |
| ); | |
| execute: async ({ input }) => { | |
| const copywriterAgent = new Agent({ | |
| name: "copywriter-agent", | |
| instructions: "You are a copywriter agent that writes blog post copy.", | |
| model: anthropic("claude-3-5-sonnet-20241022") as any, | |
| }); | |
| const result = await copywriterAgent.generate( | |
| `Create a blog post about ${input.topic}`, | |
| ); |
🤖 Prompt for AI Agents
In frameworks/mastra/supervisor-agent/src/tools/copywriter.ts around lines 15 to
24, the tool currently reads context.topic which will be undefined; replace
usage with input.topic to match the declared inputSchema and ensure the prompt
is formed correctly (e.g., read the topic from the function's input object and
interpolate input.topic into the generate call). Ensure any parameter names and
types align with the surrounding code so the agent receives a valid string.
Add Mastra supervisor agent wrapper
Summary
This PR converts the Mastra supervisor agent example to work within Agentuity's framework, following the established wrapper patterns while preserving all original Mastra functionality.
Key Components Added:
src/agents/mastra-supervisor-agent/index.ts) - Coordinates copywriter, editor, and publisher agents using Mastra's Agent classsrc/tools/copywriter.ts) - Mastra tool that wraps the copywriter agent functionalityThe implementation preserves the original three-agent coordination pattern from the Mastra documentation while wrapping it in Agentuity's request/response structure with proper error handling and logging.
Review & Testing Checklist for Human
This is a medium-high risk PR due to framework integration complexity and untested multi-agent coordination logic.
bun installandagentuity buildsucceed without errorsRecommended Test Plan:
bun installagentuity devand try the example prompts from the welcome functionNotes
Summary by CodeRabbit
New Features
Documentation
Chores