-
Notifications
You must be signed in to change notification settings - Fork 5
Mastra: Add System Prompt example wrapped with Agentuity #39
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
Conversation
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 System Prompt example under frameworks/mastra/system-prompt: project config, package and tsconfig, runner entrypoint, README, .gitignore, and an agent exposing welcome() plus a default Agentuity handler that integrates Mastra Agent with OpenAI and supports runtime system prompts. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant Runner as Agentuity Runner
participant Agent as Mastra Agent Handler
participant Mastra
participant OpenAI
Client->>Runner: HTTP request (body text)
Runner->>Agent: Invoke default Agent(req, resp, ctx)
Note over Agent: read req.data.text()<br/>detect "system: ...\n" prefix
Agent->>Mastra: instantiate Mastra Agent (gpt-4o-mini, instructions)
Agent->>Mastra: generate(userMessage, optionalSystem)
Mastra->>OpenAI: model completion request
OpenAI-->>Mastra: completion
Mastra-->>Agent: result.text
Agent-->>Runner: resp.text(generatedText)
Runner-->>Client: HTTP response (text)
rect rgba(255,235,205,0.35)
note right of Agent: on error → ctx.logger.error() and return generic error text
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
…gn dependency versions Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
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: 6
🧹 Nitpick comments (4)
frameworks/mastra/system-prompt/package.json (1)
1-11: Confirm Mastra version compatibility; other examples use a newer range.PR notes mention other examples use @mastra/core ^0.9.4. Aligning reduces API drift.
If compatible, bump:
"dependencies": { "@agentuity/sdk": "workspace:*", "@ai-sdk/openai": "^1.0.0", - "@mastra/core": "^0.6.0" + "@mastra/core": "^0.9.4" }Optionally add engines to document the Node requirement:
"type": "module", + "engines": { "node": ">=18.17" },frameworks/mastra/system-prompt/README.md (1)
1-7: Add quickstart and env var note.Include minimal steps (agentuity dev path, OPENAI_API_KEY requirement, sample prompts) so users can run it immediately.
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts (2)
16-20: Add explicit return type to the handler.Clarifies intent and avoids implicit
any/inference drift across SDK upgrades.-export default async function Agent( +export default async function Agent( req: AgentRequest, resp: AgentResponse, ctx: AgentContext -) { +): Promise<void> {
40-46: Log the error object for stack/context.Structured logging preserves stack traces in most loggers.
- ctx.logger.error( - 'Mastra system-prompt agent error: %s', - error instanceof Error ? error.message : String(error) - ); + ctx.logger.error( + { err: error }, + 'Mastra system-prompt agent error' + );
📜 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 (6)
frameworks/mastra/system-prompt/README.md(1 hunks)frameworks/mastra/system-prompt/agentuity.yaml(1 hunks)frameworks/mastra/system-prompt/index.ts(1 hunks)frameworks/mastra/system-prompt/package.json(1 hunks)frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts(1 hunks)frameworks/mastra/system-prompt/tsconfig.json(1 hunks)
🧰 Additional context used
🧠 Learnings (23)
📚 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/system-prompt/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/system-prompt/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/system-prompt/package.json
📚 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/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/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 : The file should export a default function
Applied to files:
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/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/mastra-system-prompt/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/system-prompt/src/agents/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/mastra-system-prompt/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/mastra-system-prompt/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/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: 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/mastra-system-prompt/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-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
📚 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-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: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/system-prompt/agentuity.yaml
🪛 Biome (2.1.2)
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts
[error] 16-16: Shouldn't redeclare 'Agent'. Consider to delete it or rename it.
'Agent' is defined here:
(lint/suspicious/noRedeclare)
🔇 Additional comments (3)
frameworks/mastra/system-prompt/agentuity.yaml (1)
1-49: Verify bundler.ignore vs. agents.dir interactionI searched all agentuity.yaml files in the repo and didn’t find any other instances of
bundler.enabled: true combined with agents.dir: src/agents and ignore: src/**.Please confirm that your bundler’s ignore rules won’t prevent discovery and bundling of the agent files under src/agents. In particular, an ignore pattern of src/** typically excludes everything in src/, which could inadvertently skip the agents directory.
– No edits are being suggested for agentuity.yaml itself per team guidance; just double-check that in your environment the bundler will still include src/agents despite the src/** ignore.
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts (2)
5-14: Welcome copy and prompts look good.Good UX for quickly exercising style changes.
34-37: Ignore the object-form suggestion forgenerate— the current core API always uses positional argumentsThe
Agent.generatemethod in all@mastra/corereleases (including 0.6.x and 0.9.x) has the signaturegenerate( messages: string | string[] | Message[], options?: GenerateOptions ): Promise<GenerateResponse>There was never a
generate({ input, system })overload. Your existing callawait agent.generate( userText, systemMessage ? { system: systemMessage } : undefined );correctly uses the two positional parameters (though note that
options.systemis not a recognized setting inGenerateOptions). If you meant to send a system prompt, include it as the first message in themessagesargument:- await agent.generate(userText, { /* … */ }); + await agent.generate([ + { role: "system", content: systemMessage }, + { role: "user", content: userText } +]);No signature change or object-form refactor is needed here.
Likely an incorrect or invalid review comment.
| import { runner } from '@agentuity/sdk'; | ||
|
|
||
| runner(true, import.meta.dirname).catch((err) => { | ||
| console.error(err); | ||
| process.exit(1); | ||
| }); |
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
Avoid relying on import.meta.dirname; use a portable ESM dirname.
Node doesn’t guarantee import.meta.dirname; using fileURLToPath works everywhere.
Apply:
-import { runner } from '@agentuity/sdk';
-
-runner(true, import.meta.dirname).catch((err) => {
+import { runner } from '@agentuity/sdk';
+import { fileURLToPath } from 'node:url';
+import { dirname } from 'node:path';
+const cwd = dirname(fileURLToPath(import.meta.url));
+runner(true, cwd).catch((err) => {
console.error(err);
process.exit(1);
});📝 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 { runner } from '@agentuity/sdk'; | |
| runner(true, import.meta.dirname).catch((err) => { | |
| console.error(err); | |
| process.exit(1); | |
| }); | |
| import { runner } from '@agentuity/sdk'; | |
| import { fileURLToPath } from 'node:url'; | |
| import { dirname } from 'node:path'; | |
| const cwd = dirname(fileURLToPath(import.meta.url)); | |
| runner(true, cwd).catch((err) => { | |
| console.error(err); | |
| process.exit(1); | |
| }); |
🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/index.ts lines 1-6, the code uses
import.meta.dirname which is not portable; replace it with a standard ESM
dirname computed via fileURLToPath. Import fileURLToPath from 'url' and path (or
path.dirname) from 'path', compute const __dirname =
path.dirname(fileURLToPath(import.meta.url)), then pass __dirname (or the
computed dirname) to runner instead of import.meta.dirname and keep the existing
.catch handler.
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts
Show resolved
Hide resolved
| const defaultInstructions = | ||
| 'You are a friendly assistant. Respond clearly and helpfully.'; | ||
|
|
||
| const agent = new Agent({ | ||
| name: 'MastraSystemPrompt', | ||
| model: openai('gpt-4o-mini'), | ||
| instructions: defaultInstructions | ||
| }); |
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
Confirm Mastra Agent option key (instructions vs system) for your pinned version.
Mastra changed naming across versions; mixing @mastra/core@^0.6.0 vs ^0.9.x can silently ignore the system text.
🌐 Web query:
For @mastra/core/agent, what are the constructor option keys for versions 0.6.x and 0.9.x (is it `instructions` or `system`), and what is the current recommended way to set default system prompt?
Error during web search
🏁 Script executed:
#!/bin/bash
set -e
# Display the Mastra System Prompt agent implementation
cat frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts | sed -n '1,200p'Length of output: 1589
🏁 Script executed:
#!/bin/bash
set -e
# Determine the installed version of @mastra/core in this repo
echo "package.json dependencies (@mastra/core):"
grep -R '"@mastra/core"' -n package.json || true
echo -e "\nframeworks/mastra/system-prompt/package.json dependencies (@mastra/core):"
grep -R '"@mastra/core"' -n frameworks/mastra/system-prompt/package.json || true
echo -e "\nlockfiles (@mastra/core entries):"
grep -R '@mastra/core@' -n yarn.lock package-lock.json || trueLength of output: 705
🏁 Script executed:
#!/bin/bash
set -e
# Inspect Agent constructor and generate method signatures for @mastra/core@0.6.0 and @mastra/core@0.9.0
for version in 0.6.0 0.9.0; do
echo "### Version $version ###"
# Get the types entry point path from package.json
types_path=$(curl -s https://unpkg.com/@mastra/core@${version}/package.json | grep -Po '"types"\s*:\s*"\K[^"]+')
echo "types path: ${types_path}"
echo "Agent constructor signature:"
curl -s https://unpkg.com/@mastra/core@${version}/${types_path} | grep -nP 'constructor\s*\(' -C2
echo
echo "generate method signature:"
curl -s https://unpkg.com/@mastra/core@${version}/${types_path} | grep -nP '\bgenerate\(' -C2
echo
doneLength of output: 4581
🏁 Script executed:
#!/bin/bash
set -e
for version in 0.6.0 0.9.0; do
echo "=== @mastra/core@$version ==="
echo -n "Types entry: "
curl -s https://unpkg.com/@mastra/core@${version}/package.json \
| grep -Po '"types"\s*:\s*"\K[^"]+' || echo "not specified"
echo
echo "AgentConfig definition:"
curl -s https://unpkg.com/@mastra/core@${version}/dist/index.d.ts \
| sed -n '/\bAgentConfig\b/,/};/p'
echo
echo "Config fields “instructions” vs “system”:"
curl -s https://unpkg.com/@mastra/core@${version}/dist/index.d.ts \
| grep -nE '\b(instructions|system)\b' -C2 || echo "— none found —"
echo -e "\n----------------------------------------\n"
doneLength of output: 15320
🏁 Script executed:
#!/bin/bash
set -e
for version in 0.6.0 0.9.0; do
echo "=== @mastra/core@$version ==="
echo "AgentConfig type definition:"
curl -s "https://unpkg.com/@mastra/core@${version}/dist/base.d.ts" \
| sed -n '/\bAgentConfig\b/,/};/p'
echo -e "\n----------------------------------------\n"
doneLength of output: 720
🏁 Script executed:
#!/bin/bash
set -e
for version in 0.6.0 0.9.0; do
echo "=== @mastra/core@$version ==="
INDEX_URL="https://unpkg.com/@mastra/core@${version}/dist/index.d.ts"
BASE_IMPORT=$(curl -s "${INDEX_URL}" | grep -oP "from './base-[^']+\\.js'" | head -1)
BASE_FILE=$(echo "${BASE_IMPORT}" | sed -n "s/from '\\.\\/\\(base-[^']*\\)\\.js'/\\1/p")
echo "Base file: ${BASE_FILE}"
BASE_D_TS_URL="https://unpkg.com/@mastra/core@${version}/dist/${BASE_FILE}.d.ts"
echo "Fetching: ${BASE_D_TS_URL}"
curl -s "${BASE_D_TS_URL}" | sed -n '/AgentConfig/,/};/p'
echo "Fields (instructions or system):"
curl -s "${BASE_D_TS_URL}" | sed -n '/AgentConfig/,/};/p' | grep -E 'instructions|system' || echo "— none found —"
echo -e "\n----------------------------------------\n"
doneLength of output: 16987
Update agent.generate to use instructions (not system)
Both @mastra/core 0.6.x and 0.9.x expect the initial prompt via the instructions key on AgentConfig, and per‐call overrides are likewise named instructions in v0.9.x (v0.6.x does not support per‐call overrides). Passing { system: … } will be ignored.
• In both versions, AgentConfig’s constructor signature is:
new Agent({ name: string; instructions: string; model: MastraLanguageModel; … }) — there is no system field .
• In v0.9.x, AgentGenerateOptions defines an optional instructions?: string override (again, no system) .
• In v0.6.x, per‐call overrides aren’t supported; only the constructor’s instructions is used .
Please update the snippet as follows:
- const result = await agent.generate(
- userText,
- systemMessage ? { system: systemMessage } : undefined
- );
+ const result = await agent.generate(
+ userText,
+ systemMessage ? { instructions: systemMessage } : undefined
+ );If you need per-call prompt overrides with v0.6.x, you’ll need to upgrade to ≥0.9.x (which supports the instructions option in generate).
📝 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.
| const defaultInstructions = | |
| 'You are a friendly assistant. Respond clearly and helpfully.'; | |
| const agent = new Agent({ | |
| name: 'MastraSystemPrompt', | |
| model: openai('gpt-4o-mini'), | |
| instructions: defaultInstructions | |
| }); | |
| const result = await agent.generate( | |
| userText, | |
| systemMessage ? { instructions: systemMessage } : undefined | |
| ); |
🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts
around lines 22–29, the agent configuration and any per-call overrides must use
the key instructions (not system); change any Agent.generate calls that pass {
system: ... } to { instructions: ... } so the prompt is respected by both
@mastra/core v0.6.x and v0.9.x (note v0.6.x only supports constructor-level
instructions, while per-call instructions require upgrading to ≥0.9.x).
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts
Outdated
Show resolved
Hide resolved
| systemMessage ? { system: systemMessage } : undefined | ||
| ); | ||
|
|
||
| return resp.text(result.text || ''); |
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
❓ Verification inconclusive
Confirm shape of result (may not be result.text).
Mastra often returns different shapes (e.g., { text: string }, { output: string }, or a string). Ensure correct extraction to avoid empty responses.
🌐 Web query:
For @mastra/core Agent.generate return value (versions 0.6.x and 0.9.x), what property contains the final text? Is it `text`, `output`, or a direct string?
Error during web search
Ensure correct extraction of generated text from result
The .generate() method in @mastra/core returns an object with a text property (no output field and not a bare string) for text‐only calls. Earlier v0.6.x of the API returned a raw string directly, so to cover both shapes you should update the code at line 39:
• File: frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts, line 39
Replace
return resp.text(result.text || '');With
const textOutput = typeof result === 'string'
? result
: result.text ?? '';
return resp.text(textOutput);References:
– Generated text lives in result.text (no output) (mastra.ai)
– Example usage: response.text holds the string (mastra.ai)
🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts
around line 39, the handler currently assumes result.text exists but older API
versions may return a bare string; update the return to normalize both shapes by
checking if result is a string and using it directly, otherwise use result.text
with a fallback empty string, then pass that normalized text to resp.text.
| { | ||
| "extends": "../../tsconfig.json", | ||
| "compilerOptions": { | ||
| "outDir": "./dist", | ||
| "rootDir": "." | ||
| }, | ||
| "include": ["./index.ts", "./src/**/*.ts"] | ||
| } |
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
TS config looks fine; verify base tsconfig resolution.
Extends path and include patterns look correct for this package layout.
Run to confirm the base file exists and sources are picked up:
🏁 Script executed:
#!/bin/bash
fd -a 'tsconfig.json' | sed -n '1,200p'
test -f frameworks/tsconfig.json && echo "OK: frameworks/tsconfig.json present" || echo "MISSING: frameworks/tsconfig.json"
test -f frameworks/mastra/system-prompt/index.ts && echo "OK: entry present"
fd -a 'src/agents/mastra-system-prompt/index.ts' frameworks/mastra/system-promptLength of output: 1674
🏁 Script executed:
#!/bin/bash
echo "Basic tsconfig content:"
sed -n '1,200p' frameworks/mastra/basic/tsconfig.json
echo ""
echo "System-prompt directory files:"
find frameworks/mastra/system-prompt -maxdepth 2 -type fLength of output: 1090
🏁 Script executed:
#!/bin/bash
echo "Bird-checker tsconfig:"
sed -n '1,20p' frameworks/mastra/bird-checker/tsconfig.json || echo "File missing"
echo ""
echo "Multi-step-workflow tsconfig:"
sed -n '1,20p' frameworks/mastra/multi-step-workflow/tsconfig.json || echo "File missing"Length of output: 1293
Fix base tsconfig path in system-prompt tsconfig
The extends field in frameworks/mastra/system-prompt/tsconfig.json
currently points to ../../tsconfig.json (which would resolve to frameworks/tsconfig.json – a non-existent file). It needs to reference the Mastra “basic” config instead:
• File: frameworks/mastra/system-prompt/tsconfig.json
– Change
"extends": "../../tsconfig.json"
to
"extends": "../basic/tsconfig.json"
🤖 Prompt for AI Agents
In frameworks/mastra/system-prompt/tsconfig.json lines 1 to 8 the "extends" path
is wrong: it currently points to "../../tsconfig.json" (non-existent) — update
the extends field to point to the Mastra basic config by changing it to
"../basic/tsconfig.json"; save the file ensuring the rest of the JSON remains
unchanged.
Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
…d index.ts env checks with mastra/basic Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
…and module resolution Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
…tch access Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
… for consistency Co-Authored-By: Dhilan Fye <dfye@agentuity.com>
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: 0
♻️ Duplicate comments (3)
frameworks/mastra/system-prompt/tsconfig.json (1)
1-4: Extend the Mastra base tsconfig to stay consistent with other examplesPrevents config drift and keeps compiler options aligned.
{ + "extends": "../basic/tsconfig.json", "compilerOptions": {frameworks/mastra/system-prompt/index.ts (1)
1-1: Portable dirname:import.meta.dirnameis Bun-only; crashes under Node
Use standard ESM pattern soagentuity dev(Node) works.-import { runner } from '@agentuity/sdk'; +import { runner } from '@agentuity/sdk'; +import { fileURLToPath } from 'node:url'; +import { dirname } from 'node:path'; +const cwd = dirname(fileURLToPath(import.meta.url)); @@ -runner(true, import.meta.dirname).catch((err) => { +runner(true, cwd).catch((err) => {Also applies to: 31-39
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts (1)
22-26: Dynamic system prompt currently ignored (wrong option key) and may be incompatible with v0.6.x — set instructions at construction and call generate(message).Mastra expects instructions, not system. Per-call overrides using { instructions } may not exist in v0.6.x, so safest is to inject the dynamic prompt via the constructor and keep generate single-arg. This both fixes behavior and maximizes version compatibility.
Apply:
- const agent = new Agent({ - name: 'MastraSystemPrompt', - model: openai('gpt-4o-mini'), - instructions: 'You are a helpful assistant.' - }); + // create with dynamic instructions (works on both 0.6.x and 0.9.x) + const baseInstructions = 'You are a helpful assistant.'; + const agent = new Agent({ + name: 'MastraSystemPrompt', + model: openai('gpt-4o-mini'), + instructions: system ?? baseInstructions + }); @@ - const result = await agent.generate(message, system ? { system } : undefined); + const result = await agent.generate(message);Also applies to: 39-39
🧹 Nitpick comments (8)
frameworks/mastra/system-prompt/README.md (1)
5-12: Minor copy polish for clarity/grammarTighten phrasing and punctuation; add “handler”; pluralize “Usage tips”.
- - Exposes Agentuity `welcome()` and default `Agent(req, resp, ctx)` - - Demonstrates passing a runtime system prompt - - Usage tip: + - Exposes Agentuity `welcome()` and default `Agent(req, resp, ctx)` handler + - Demonstrates passing a runtime system prompt. + + Usage tips:frameworks/mastra/system-prompt/package.json (1)
23-31: Drop the umbrella “mastra” dependency to avoid version skewSince there are no direct imports of the top-level
mastrapackage inframeworks/mastra/system-prompt(confirmed by your search), you can safely remove it and rely solely on the scoped@mastra/coredependency.• File to update:
- frameworks/mastra/system-prompt/package.json (lines 23–31)
Suggested change:
"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" + "ai": "^4.3.16" }, "module": "index.ts" }frameworks/mastra/system-prompt/index.ts (2)
9-12: Fix guidance: Node can’t run.tsdirectly with--env-file
Point users toagentuity dev(or Bun) instead of suggestingnode index.ts.- '\x1b[31m[ERROR] Re-run the command with `node --env-file .env index.ts`\x1b[0m' + '\x1b[31m[ERROR] Re-run with `agentuity dev` (reads .env automatically), or set AGENTUITY_* keys in your environment.\x1b[0m'
16-29: Use yellow for warnings (not red)
ANSI 33m better conveys warning vs error.- '\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/src/agents/mastra-system-prompt/index.ts (4)
39-40: Normalize generate() return shape (string vs { text }).Covers both older and newer Mastra return types.
- const result = await agent.generate(message); - return resp.text(result.text || ''); + const result = await agent.generate(message); + const textOutput = typeof result === 'string' ? result : (result?.text ?? ''); + return resp.text(textOutput);
28-37: Make runtime prompt parsing more forgiving (JSON envelope and “system:” without newline).Optional but improves DX for callers.
- const input = (await req.data.text()) || 'Hello there!'; - let system: string | undefined; - let message = input; - - const m = input.match(/^system:\s*(.+)\n([\s\S]*)$/i); - if (m) { - const [, sys, rest] = m; - system = (sys || '').trim(); - message = (rest || '').trim() || 'Continue.'; - } + const raw = ((await req.data.text()) ?? '').trim(); + let system: string | undefined; + let message = raw || 'Hello there!'; + + // JSON envelope: { "user": "...", "system": "..." } + if (raw.startsWith('{')) { + try { + const parsed = JSON.parse(raw); + if (typeof parsed.user === 'string') message = parsed.user; + if (typeof parsed.system === 'string') system = parsed.system; + } catch { /* ignore malformed JSON */ } + } + // "system: ..." line, message optional + const m = raw.match(/^system:\s*([^\n]+)(?:\n([\s\S]*))?$/i); + if (m) { + system = m[1].trim(); + message = (m[2]?.trim() || 'Continue.'); + }
41-47: Include error object in logs to preserve stack.If logger supports it, pass error as an object/second arg for better diagnostics.
1-3: Optional: Alias Mastra’s Agent class for clarityNo change is needed for the SDK import path—it’s consistently
@agentuity/sdkeverywhere in the repo.If you’d like to make it extra clear which
Agentyou’re using, you can optionally alias the Mastra class:-import type { AgentContext, AgentRequest, AgentResponse } from '@agentuity/sdk'; +import type { AgentContext, AgentRequest, AgentResponse } from '@agentuity/sdk'; -import { Agent } from '@mastra/core/agent'; +import { Agent as MastraAgent } from '@mastra/core/agent'; // optional alias // …and, if you alias, update any `new Agent(...)` calls to `new MastraAgent(...)`
📜 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 ignored due to path filters (1)
frameworks/mastra/system-prompt/bun.lockis excluded by!**/*.lock
📒 Files selected for processing (7)
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/index.ts(1 hunks)frameworks/mastra/system-prompt/package.json(1 hunks)frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts(1 hunks)frameworks/mastra/system-prompt/tsconfig.json(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- frameworks/mastra/system-prompt/agentuity.yaml
🧰 Additional context used
🧠 Learnings (26)
📚 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/system-prompt/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/system-prompt/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/system-prompt/tsconfig.json
📚 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 : Consider agent communication for complex workflows
Applied to files:
frameworks/mastra/system-prompt/tsconfig.jsonframeworks/mastra/system-prompt/src/agents/mastra-system-prompt/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 : All code should be in Typescript format
Applied to files:
frameworks/mastra/system-prompt/tsconfig.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/system-prompt/tsconfig.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/system-prompt/tsconfig.json
📚 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: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`), 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/package.jsonframeworks/mastra/system-prompt/src/agents/mastra-system-prompt/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 loading types from the node modules package `agentuity/sdk` in the node_modules folder
Applied to files:
frameworks/mastra/system-prompt/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/system-prompt/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/system-prompt/package.json
📚 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/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/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/system-prompt/src/agents/mastra-system-prompt/index.ts
📚 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 Agent files for Agentuity, always export a default function, preferably named 'Agent' or contextually after the Agent, to ensure consistency and clarity.
Applied to files:
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts
📚 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 : Consider agent communication (e.g., `response.handoff`, `context.getAgent`) for complex workflows
Applied to files:
frameworks/mastra/system-prompt/src/agents/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/mastra-system-prompt/index.ts
📚 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: When developing Agentuity AI Agents, import types such as `AgentRequest`, `AgentResponse`, and `AgentContext` from the `agentuity/sdk` package to maintain type safety and leverage SDK-provided interfaces.
Applied to files:
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/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/mastra-system-prompt/index.ts
📚 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 Agent files for Agentuity, prefer importing types such as AgentRequest, AgentResponse, and AgentContext from the `agentuity/sdk` package to ensure type consistency and compatibility.
Applied to files:
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/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/mastra-system-prompt/index.ts
🪛 LanguageTool
frameworks/mastra/system-prompt/README.md
[grammar] ~5-~5: There might be a mistake here.
Context: ...(@mastra/core/agent, @ai-sdk/openai) - Exposes Agentuity welcome() and defaul...
(QB_NEW_EN)
[grammar] ~9-~9: There might be a mistake here.
Context: ...sing a runtime system prompt Usage tip: - Prefix your input with a system line to ...
(QB_NEW_EN)
🔇 Additional comments (2)
frameworks/mastra/system-prompt/.gitignore (1)
1-37: LGTM — sensible ignores for this packageCovers node_modules, build artifacts, env files, and .agentuity. Nothing to change.
frameworks/mastra/system-prompt/src/agents/mastra-system-prompt/index.ts (1)
5-14: Welcome payload looks good.Samples clearly demonstrate the runtime system-prompt pattern.
|
Closing due to inactivity for more than 30 days. Configure here. |
Mastra: Add System Prompt example wrapped with Agentuity
Summary
Adds a new Mastra framework example at
frameworks/mastra/system-prompt/that wraps the Mastra "Changing the System Prompt" pattern with Agentuity's interface. The implementation preserves Mastra framework imports (@mastra/core/agent,@ai-sdk/openai) and provides the standard Agentuity wrapper withwelcome()function andAgent(req, resp, ctx)handler.Key files added:
src/agents/mastra-system-prompt/index.tsReview & Testing Checklist for Human
Risk Level: Yellow - 2 items to verify
systemMessageand may not demonstrate dynamic system prompt changes as intended.agentuity devand test the character-based prompts ("Speak like Harry Potter") to ensure the Mastra Agent API calls work correctly and produce expected character responses.Recommended Test Plan
agentuity devin the new directoryNotes
Summary by CodeRabbit
New Features
Documentation
Chores