Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Aug 27, 2025

Add Mastra system-prompt example wrapper

Summary

This PR adds a new Mastra framework example that demonstrates system prompts by implementing a Harry Potter character agent. The agent can respond as different characters (Harry, Hermione, Ron) with their distinctive personalities, showcasing how Mastra's system prompts can change agent behavior.

Key changes:

  • Created frameworks/mastra/system-prompt/ directory with complete project structure
  • Implemented HarryPotterAgent that preserves ALL original Mastra framework code
  • Added Agentuity wrapper with welcome() function and proper error handling
  • Followed existing framework integration patterns from other examples
  • Added comprehensive README documentation

The implementation converts the Mastra system-prompt example into an Agentuity wrapper while preserving the original framework patterns:

  • Uses @mastra/core/agent for agent creation
  • Maintains original Agent constructor with name, model, instructions
  • Keeps original agent.generate() method call
  • Preserves all Mastra-specific configuration

Review & Testing Checklist for Human

  • Test agent functionality end-to-end by running agentuity dev and verifying the agent responds correctly to character-specific prompts
  • Verify system prompt behavior matches the original Mastra example - test with prompts like "Speak as Harry Potter..." and confirm character personality comes through
  • Check framework preservation - ensure the Mastra Agent creation and usage exactly matches the original documentation patterns

Notes

  • Lint checks pass successfully ✅
  • Build requires Agentuity authentication so couldn't test locally, but dependencies install correctly
  • Used same package versions as existing frameworks/mastra/basic/ example for consistency
  • Character traits are defined in system instructions but may need refinement based on testing

Session requested by: Dhilan Fye (dfye@agentuity.com)
Link to Devin run: https://app.devin.ai/sessions/9476b6e4087942e1b116279d7fb2a98f

Summary by CodeRabbit

  • New Features

    • Introduces a Mastra system‑prompt example integrated with Agentuity.
    • Adds a character agent (Harry, Hermione, Ron) responding in‑character.
    • Includes a startup flow with environment checks and helpful guidance.
  • Documentation

    • Adds README with workflow overview, usage examples, and development commands.
  • Chores

    • Adds configuration for development/deployment (Bun), package scripts, and resource settings.
    • Enables strict TypeScript and Biome lint/format rules.
    • Adds comprehensive ignore rules to keep logs, builds, and caches out of version control.

- Convert Mastra Harry Potter character agent to Agentuity wrapper
- Preserve all original Mastra framework code and patterns
- Add welcome() function with character prompts
- Implement proper error handling with ctx.logger
- Follow existing frameworks/ directory conventions

Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 27, 2025

Walkthrough

Introduces a new Mastra-based “system-prompt” example wrapped with Agentuity. Adds project scaffolding and configs, a startup runner that validates environment variables and boots the Agentuity runner, a HarryPotterAgent implementing character-based responses via Mastra/Anthropic, and documentation describing setup and usage.

Changes

Cohort / File(s) Summary
Project scaffolding & config
frameworks/mastra/system-prompt/.gitignore, .../package.json, .../tsconfig.json, .../biome.json, .../agentuity.yaml
Adds ignore rules, package metadata and scripts, strict TS and Biome config, and Agentuity project configuration (dev/deploy commands, resources, bundler, single agent entry).
Runner entrypoint
frameworks/mastra/system-prompt/index.ts
Adds startup script that checks required environment variables, outputs guidance for Node/Bun usage, and launches the Agentuity runner with error handling.
Agent implementation
frameworks/mastra/system-prompt/src/agents/HarryPotterAgent/index.ts
Adds a character agent using Mastra with Anthropic Claude, providing a welcome() helper and default handler that reads input, generates in-character responses, and returns text with logging and basic error handling.
Documentation
frameworks/mastra/system-prompt/README.md
Adds README describing the example, workflow, dependencies, and development commands.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor User
    participant Agentuity as Agentuity Runner
    participant HPAgent as HarryPotterAgent
    participant Mastra as Mastra Agent
    participant LLM as Anthropic Claude

    User->>Agentuity: AgentRequest (text)
    Agentuity->>HPAgent: Invoke handler(req, resp, ctx)
    HPAgent->>HPAgent: Parse input / fallback sample
    HPAgent->>Mastra: Construct Agent (model: Claude, instructions)
    Mastra->>LLM: Generate(text, maxSteps=3)
    LLM-->>Mastra: Result (text)
    Mastra-->>HPAgent: result.text or undefined
    alt result.text present
        HPAgent->>Agentuity: resp.text(result)
    else error or missing text
        HPAgent->>Agentuity: resp.text(fallback/error)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • rblalock
  • jhaynie

Poem

I twitch my ears at Bun’s soft hum,
A wand of code—expelliarmus!—I drum.
Mastra whispers, Claude replies,
Three friends speak through prompt-filled skies.
Logs stay buried, builds take flight—
Hippity-hop, we ship tonight! 🪄🐇

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/1756320605-mastra-system-prompt-wrapper

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot requested review from jhaynie and rblalock August 27, 2025 18:58
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (7)
frameworks/mastra/system-prompt/biome.json (1)

12-15: Lock formatter width for deterministic diffs.

Set indentWidth to avoid editor defaults drifting formatting.

   "formatter": {
     "enabled": true,
-    "indentStyle": "space"
+    "indentStyle": "space",
+    "indentWidth": 2
   },
frameworks/mastra/system-prompt/tsconfig.json (1)

10-11: Composite + noEmit is unusual here.

"composite": true is mainly for project references and typically paired with emitting declarations. If this package isn’t referenced by others via TS project refs, consider disabling to simplify.

-    "composite": true,
+    "composite": false,
frameworks/mastra/system-prompt/index.ts (1)

16-29: Use yellow for warnings to distinguish from errors.

ANSI 33 (yellow) is clearer for warnings than 31 (red).

-    '\x1b[31m[WARN] You are running this agent outside of the Agentuity environment. Any automatic Agentuity features will be disabled.\x1b[0m'
+    '\x1b[33m[WARN] You are running this agent outside of the Agentuity environment. Any automatic Agentuity features will be disabled.\x1b[0m'
...
-      '\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of bun run start.\x1b[0m'
+      '\x1b[33m[WARN] Recommend running `agentuity dev` to run your project locally instead of bun run start.\x1b[0m'
...
-      '\x1b[31m[WARN] Recommend running `agentuity dev` to run your project locally instead of npm start.\x1b[0m'
+      '\x1b[33m[WARN] Recommend running `agentuity dev` to run your project locally instead of npm start.\x1b[0m'
frameworks/mastra/system-prompt/package.json (1)

1-31: Declare Bun engine for clarity.

Since start requires Bun, add an engines field.

   "private": true,
+  "engines": {
+    "bun": ">=1.1.0"
+  },
frameworks/mastra/system-prompt/src/agents/HarryPotterAgent/index.ts (2)

28-29: Confirm model slug availability.

Validate that anthropic('claude-3-7-sonnet-latest') is a valid identifier in your deployed environment/SDK version; consider making it configurable via env for easier upgrades.


51-53: Improve error logging for debuggability.

Prefer structured logging to preserve stack/fields rather than string interpolation.

-} catch (error) {
-  ctx.logger.error(`HarryPotterAgent Error: ${error}`);
+} catch (error) {
+  ctx.logger.error({ error }, 'HarryPotterAgent error');
frameworks/mastra/system-prompt/README.md (1)

11-15: Tighten list punctuation and step formatting.

Minor Markdown/grammar nits to improve readability.

- - **Character-based responses**: The agent can respond as Harry Potter, Hermione Granger, or Ron Weasley
- - **System prompt demonstration**: Shows how Mastra's system prompts can change agent behavior
- - **Preserved framework code**: All original Mastra Agent creation and configuration is maintained
- - **Agentuity integration**: Proper error handling, logging, and response formatting
+ - **Character-based responses**: The agent can respond as Harry Potter, Hermione Granger, or Ron Weasley.
+ - **System prompt demonstration**: Shows how Mastra's system prompts can change agent behavior.
+ - **Preserved framework code**: All original Mastra Agent creation and configuration is maintained.
+ - **Agentuity integration**: Proper error handling, logging, and response formatting.

-1. Receives input through Agentuity's `AgentRequest`
-2. Creates a Mastra `Agent` with character-specific instructions
-3. Generates a response using the original Mastra framework
-4. Returns the result through Agentuity's `AgentResponse`
+1. Receives input through Agentuity's `AgentRequest`.
+2. Creates a Mastra `Agent` with character-specific instructions.
+3. Generates a response using the original Mastra framework.
+4. Returns the result through Agentuity's `AgentResponse`.

- - Uses `@mastra/core/agent` for agent creation
- - Preserves the original `Agent` constructor with `name`, `model`, and `instructions`
- - Keeps the original `agent.generate()` method call
- - Maintains all Mastra-specific configuration and behavior
+ - Uses `@mastra/core/agent` for agent creation.
+ - Preserves the original `Agent` constructor with `name`, `model`, and `instructions`.
+ - Keeps the original `agent.generate()` method call.
+ - Maintains all Mastra-specific configuration and behavior.

- - `@mastra/core`: Core Mastra framework
- - `@ai-sdk/anthropic`: Anthropic AI SDK for Claude models
- - `@agentuity/sdk`: Agentuity SDK for wrapper functionality
+ - `@mastra/core`: Core Mastra framework.
+ - `@ai-sdk/anthropic`: Anthropic AI SDK for Claude models.
+ - `@agentuity/sdk`: Agentuity SDK for wrapper functionality.

Also applies to: 20-24, 35-39, 61-64

📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 61337c0 and 323a231.

⛔ Files ignored due to path filters (1)
  • frameworks/mastra/system-prompt/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • frameworks/mastra/system-prompt/.gitignore (1 hunks)
  • frameworks/mastra/system-prompt/README.md (1 hunks)
  • frameworks/mastra/system-prompt/agentuity.yaml (1 hunks)
  • frameworks/mastra/system-prompt/biome.json (1 hunks)
  • frameworks/mastra/system-prompt/index.ts (1 hunks)
  • frameworks/mastra/system-prompt/package.json (1 hunks)
  • frameworks/mastra/system-prompt/src/agents/HarryPotterAgent/index.ts (1 hunks)
  • frameworks/mastra/system-prompt/tsconfig.json (1 hunks)
🧰 Additional context used
🧠 Learnings (19)
📚 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/system-prompt/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/system-prompt/index.ts
📚 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/system-prompt/src/agents/HarryPotterAgent/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/system-prompt/src/agents/HarryPotterAgent/index.ts
📚 Learning: 2025-06-23T17:16:08.480Z
Learnt from: CR
PR: agentuity/examples#0
File: frameworks/openai/from-oai-typescript/.cursor/rules/sdk.mdc:0-0
Timestamp: 2025-06-23T17:16:08.480Z
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/system-prompt/src/agents/HarryPotterAgent/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/system-prompt/src/agents/HarryPotterAgent/index.ts
📚 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/system-prompt/src/agents/HarryPotterAgent/index.ts
📚 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/system-prompt/src/agents/HarryPotterAgent/index.ts
📚 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/system-prompt/agentuity.yaml
📚 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/system-prompt/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/system-prompt/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/system-prompt/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/system-prompt/agentuity.yaml
📚 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/system-prompt/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/system-prompt/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/system-prompt/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/system-prompt/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/system-prompt/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/system-prompt/agentuity.yaml
🪛 LanguageTool
frameworks/mastra/system-prompt/README.md

[grammar] ~20-~20: There might be a mistake here.
Context: ... 1. Receives input through Agentuity's AgentRequest 2. Creates a Mastra Agent with character-...

(QB_NEW_EN)


[grammar] ~21-~21: There might be a mistake here.
Context: ...nt` with character-specific instructions 3. Generates a response using the original ...

(QB_NEW_EN)


[grammar] ~22-~22: There might be a mistake here.
Context: ...onse using the original Mastra framework 4. Returns the result through Agentuity's `...

(QB_NEW_EN)


[grammar] ~35-~35: There might be a mistake here.
Context: ... @mastra/core/agent for agent creation - Preserves the original Agent construct...

(QB_NEW_EN)


[grammar] ~36-~36: There might be a mistake here.
Context: ...constructor withname, model, and instructions- Keeps the originalagent.generate()` me...

(QB_NEW_EN)


[grammar] ~37-~37: There might be a mistake here.
Context: ... original agent.generate() method call - Maintains all Mastra-specific configurat...

(QB_NEW_EN)


[grammar] ~61-~61: There might be a mistake here.
Context: ... - @mastra/core: Core Mastra framework - @ai-sdk/anthropic: Anthropic AI SDK for Claude models - `...

(QB_NEW_EN)


[grammar] ~62-~62: There might be a mistake here.
Context: ...pic: Anthropic AI SDK for Claude models - @agentuity/sdk`: Agentuity SDK for wrapper functionalit...

(QB_NEW_EN)

🔇 Additional comments (7)
frameworks/mastra/system-prompt/index.ts (2)

1-1: LGTM on using the SDK runner.

Import path and usage align with other examples; error handling is present.


31-39: Confirmed runner signature and baseDir usage

  • frameworks/mastra/system-prompt/package.json (line 24) is pinned to @agentuity/sdk@^0.0.116.
  • frameworks/mastra/system-prompt/index.ts (line 31) invokes runner(true, import.meta.dirname), i.e. a boolean and the example’s root directory.

No changes required.

frameworks/mastra/system-prompt/.gitignore (1)

132-134: Nice: Agentuity artifacts ignored.

Including .agentuity/ prevents noise and accidental commits.

frameworks/mastra/system-prompt/package.json (2)

6-13: Scripts align with Agentuity/Bun flow.

Build/dev/bundle/start look consistent for this example.


24-29: Dependency versions are already aligned

All five dependencies in frameworks/mastra/system-prompt/package.json match exactly with those in frameworks/mastra/basic/package.json, so no further changes are needed.

frameworks/mastra/system-prompt/src/agents/HarryPotterAgent/index.ts (1)

5-14: Helper looks good and is useful for UX.

welcome() is concise and aligns with the example prompts.

frameworks/mastra/system-prompt/agentuity.yaml (1)

1-74: Config acknowledged (no edits suggested).

Per project guidelines, not suggesting changes to Agentuity config. Looks consistent with the new agent.

Comment on lines +3 to +11
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Biome isn’t honoring .gitignore; add VCS ignores or explicit ignores to avoid linting .agentuity output.

With vcs.enabled: false and useIgnoreFile: false, Biome will not respect .gitignore. Once agentuity bundle creates .agentuity/, biome lint . may scan it and produce noise. Recommend enabling VCS ignores or explicitly ignoring build artifacts (at least .agentuity, dist, coverage).

Apply:

   "vcs": {
-    "enabled": false,
+    "enabled": true,
     "clientKind": "git",
-    "useIgnoreFile": false
+    "useIgnoreFile": true
   },
   "files": {
     "ignoreUnknown": false,
-    "ignore": []
+    "ignore": [".agentuity", "dist", "coverage"]
   },
📝 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.

Suggested change
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
},
"files": {
"ignoreUnknown": false,
"ignore": [".agentuity", "dist", "coverage"]
},
🤖 Prompt for AI Agents
frameworks/mastra/system-prompt/biome.json lines 3-11: Biome is configured with
vcs.enabled: false and useIgnoreFile: false so it will not respect .gitignore
and may lint generated artifacts like .agentuity; update the configuration to
either enable VCS ignore handling (set "vcs.enabled": true or "useIgnoreFile":
true) or add explicit ignores (add ".agentuity", "dist", "coverage" to the
"files.ignore" array) so those build/test artifacts are excluded from linting.

Comment on lines +7 to +13
const cmd = process.env._ || '';
if (cmd.endsWith('node')) {
console.error(
'\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m'
);
}
process.exit(1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Incorrect recovery tip: Node can’t run TypeScript directly.

The suggestion to re-run with node --env-file .env index.ts won’t work without a loader (tsx/ts-node). Provide actionable guidance that matches this repo’s flow.

-  const cmd = process.env._ || '';
-  if (cmd.endsWith('node')) {
-    console.error(
-      '\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m'
-    );
-  }
+  console.error(
+    '\x1b[31m[ERROR] Use `agentuity dev` (recommended) or `bun --env-file .env run index.ts`.\x1b[0m'
+  );
📝 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.

Suggested change
const cmd = process.env._ || '';
if (cmd.endsWith('node')) {
console.error(
'\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m'
);
}
process.exit(1);
console.error(
'\x1b[31m[ERROR] Use `agentuity dev` (recommended) or `bun --env-file .env run index.ts`.\x1b[0m'
);
process.exit(1);
🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/index.ts around lines 7 to 13, the error
message suggests re-running Node on a .ts file directly which is invalid; update
the message to provide actionable, repo-accurate guidance: replace the current
tip with one that tells users to either run the TypeScript with the project’s
supported loader (e.g., tsx or ts-node) or run the compiled JavaScript (e.g.,
node dist/index.js), and/or invoke the repository’s provided script
(npm/yarn/pnpm start or dev) — keep the exit(1) but ensure the message
references the supported run options used by this repo.

Comment on lines +31 to +39
runner(true, import.meta.dirname).catch((err) => {
if (err instanceof Error) {
console.error(err.message);
console.error(err.stack);
} else {
console.error(err);
}
process.exit(1);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Make import.meta dirname cross-runtime safe (Bun and Node ESM).

import.meta.dirname is Bun-specific. Outside Bun, prefer fileURLToPath(import.meta.url).

+import { fileURLToPath } from 'node:url';
+import path from 'node:path';
@@
-runner(true, import.meta.dirname).catch((err) => {
+const baseDir =
+  typeof (import.meta as any).dirname === 'string'
+    ? (import.meta as any).dirname
+    : path.dirname(fileURLToPath(import.meta.url));
+
+runner(true, baseDir).catch((err) => {
📝 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.

Suggested change
runner(true, import.meta.dirname).catch((err) => {
if (err instanceof Error) {
console.error(err.message);
console.error(err.stack);
} else {
console.error(err);
}
process.exit(1);
});
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const baseDir =
typeof (import.meta as any).dirname === 'string'
? (import.meta as any).dirname
: path.dirname(fileURLToPath(import.meta.url));
runner(true, baseDir).catch((err) => {
if (err instanceof Error) {
console.error(err.message);
console.error(err.stack);
} else {
console.error(err);
}
process.exit(1);
});
🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/index.ts around lines 31 to 39, the code uses
Bun-only import.meta.dirname which breaks on other ESM runtimes; replace it with
a cross-runtime solution that falls back to Node-compatible file URL conversion:
compute a dirname by using import.meta.dirname when defined, otherwise derive it
with path.dirname(fileURLToPath(import.meta.url)); ensure you import
fileURLToPath from 'url' and path from 'path' at the top, then pass that dirname
into runner(true, dirname).

@@ -0,0 +1,55 @@
import type { AgentContext, AgentRequest, AgentResponse } from '@agentuity/sdk';
import { anthropic } from '@ai-sdk/anthropic';
import { Agent } from '@mastra/core/agent';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix symbol shadowing: function name ‘Agent’ collides with imported class ‘Agent’.

At runtime, new Agent(...) would reference the function, not the Mastra class. Alias the import (or rename the function) to avoid a hard failure.

-import { Agent } from '@mastra/core/agent';
+import { Agent as MastraAgent } from '@mastra/core/agent';
@@
-    const agent = new Agent({
+    const agent = new MastraAgent({

Also applies to: 27-27

🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/src/agents/HarryPotterAgent/index.ts around
lines 3 and 27, the local function named "Agent" shadows the imported class
Agent causing new Agent(...) to reference the function rather than the class;
rename one of them to avoid collision (for example alias the import: import {
Agent as MastraAgent } from '@mastra/core/agent' and update usages that should
instantiate the class to MastraAgent, or rename the local function to clarifying
name) and run a quick search/replace to update all references accordingly so
instantiation and type references point to the correct symbol.

@devin-ai-integration
Copy link
Contributor Author

Closing due to inactivity for more than 30 days. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant