Skip to content

Conversation

@dhilanfye34
Copy link
Contributor

@dhilanfye34 dhilanfye34 commented Jun 19, 2025

Summary by CodeRabbit

  • New Features

    • Introduced a Cat Fact AI agent that provides expert cat information and integrates real cat facts into responses.
    • Added a Blog Publisher AI agent that coordinates content creation and editing for blog posts using multiple AI models.
    • Implemented a Startup News Scraper agent that fetches, summarizes, and delivers daily startup news digests.
  • Documentation

    • Added comprehensive README files for all agents, including setup instructions, workflows, and troubleshooting.
    • Provided detailed guidelines and API references for building AI agents with Agentuity and Mastra.
  • Configuration

    • Included project configuration files for development, deployment, formatting, and linting.
    • Added environment, ignore, and TypeScript configuration files for consistent development experience.
  • Workflow Automation

    • Integrated n8n workflow for automated daily news delivery via Email, Slack, and Discord.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 19, 2025

Walkthrough

This change introduces three new Agentuity-based AI agent projects: Startup News Scraper, Blog Publisher, and Cat Fact Agent. Each project includes configuration files, documentation, code for agent logic, and workflow or tool integrations. The updates also provide detailed SDK usage guidelines, editor settings, and project-specific TypeScript configurations.

Changes

Files/Paths Change Summary
.editorconfig, .gitignore, biome.json, tsconfig.json, package.json (all projects) Added editor, linting, formatting, and runtime configuration files for consistent development environments and dependency management across all agent projects.
.cursor/rules/agent.mdc, .cursor/rules/agentuity.mdc, .cursor/rules/sdk.mdc (all) Introduced documentation and guidelines for creating Agentuity agents, project configuration, and SDK API usage, including best practices and example code snippets.
README.md (all projects) Added comprehensive documentation for each agent project, describing purpose, setup, workflow, prerequisites, troubleshooting, and links to further resources.
agentuity.yaml (all projects) Added Agentuity project configuration files specifying agent metadata, development and deployment settings, bundler configuration, and agent declarations.
index.ts (all projects) Introduced entry scripts for each agent project to initialize and run the Agentuity agent, including environment checks and error handling.
src/agents/.../index.ts, src/agents/.../types.ts, src/agents/.../fetchFeeds.ts, src/agents/.../summarize.ts (Startup News Scraper) Implemented the Startup News Scraper agent logic: fetching and filtering RSS feeds, summarizing startup news using OpenAI, defining shared types, and handling agent requests and responses.
n8n_workflow/workflow.json (Startup News Scraper) Added an n8n workflow for daily automation: fetches startup news, summarizes, formats as HTML, and delivers via Email, Slack, and Discord.
src/agents/supervisor/agents.ts, src/agents/supervisor/index.ts (Blog Publisher) Implemented a hierarchical multi-agent system for blog publishing: Copywriter and Editor agents coordinated by a Publisher supervisor, using Mastra and OpenAI/Anthropic models.
src/agents/cat-agent/cat.ts, src/agents/cat-agent/index.ts (Cat Fact Agent) Added a cat fact expert agent using Mastra and OpenAI, integrating a tool to fetch real cat facts from an external API and respond to user queries with verified information.

Sequence Diagram(s)

Startup News Scraper Agent Flow

sequenceDiagram
    participant User
    participant n8n Workflow
    participant StartupScraperAgent
    participant OpenAI

    User->>n8n Workflow: Triggers daily schedule
    n8n Workflow->>StartupScraperAgent: HTTP POST (optionally with perFeed)
    StartupScraperAgent->>StartupScraperAgent: Fetch and filter RSS feeds
    StartupScraperAgent->>OpenAI: Summarize startup news articles
    OpenAI-->>StartupScraperAgent: Summaries
    StartupScraperAgent-->>n8n Workflow: JSON response with summaries
    n8n Workflow->>n8n Workflow: Format HTML digest
    n8n Workflow->>Slack: Send digest
    n8n Workflow->>Email: Send digest
    n8n Workflow->>Discord: Send digest
Loading

Blog Publisher Multi-Agent Workflow

sequenceDiagram
    participant User
    participant PublisherAgent
    participant CopywriterAgent
    participant EditorAgent

    User->>PublisherAgent: Provide blog topic
    PublisherAgent->>CopywriterAgent: Generate draft copy
    CopywriterAgent-->>PublisherAgent: Draft copy
    PublisherAgent->>EditorAgent: Edit draft copy
    EditorAgent-->>PublisherAgent: Edited copy
    PublisherAgent-->>User: Return final blog post
Loading

Cat Fact Agent Flow

sequenceDiagram
    participant User
    participant CatFactAgent
    participant CatFactTool
    participant OpenAI

    User->>CatFactAgent: Ask for cat fact or info
    CatFactAgent->>CatFactTool: Fetch real cat fact
    CatFactTool-->>CatFactAgent: Cat fact
    CatFactAgent->>OpenAI: Compose response with fact
    OpenAI-->>CatFactAgent: Response
    CatFactAgent-->>User: Return answer with cat fact
Loading

Suggested reviewers

  • rblalock
  • nnance

Poem

( )
(_/) Hopping through code, a rabbit so spry,
( •_•) New agents are born, let their queries fly!
/ >🍃 News, blogs, and cat facts—delightful to see,
Each project a warren, in TypeScript with glee.
With n8n and Mastra, the future feels bright—
Let’s ship these new features, and hop into the night!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment

🪧 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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 nnance and rblalock June 19, 2025 18:46
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: 14

🔭 Outside diff range comments (2)
frameworks/mastra/cat-fact-agent/.cursor/rules/agent.mdc (1)

37-37: Fix missing closing markdown fence.

The document is missing a closing triple backtick (```) which will cause rendering issues.

Apply this diff to fix the markdown syntax:

 The AgentContext has information specific to the incoming Agent request and a set of helper methods for accessing AI services like KeyValue storage and Vector storage.
+```
agents/Startup_News_Scraper/.cursor/rules/sdk.mdc (1)

98-98: Fix missing closing markdown fence.

The document is missing a closing triple backtick (```) at the end which will cause rendering issues.

Apply this diff to fix the markdown syntax:

 For complete documentation, visit: https://agentuity.dev/SDKs/javascript/api-reference
+```
♻️ Duplicate comments (1)
frameworks/mastra/blog-publisher/package.json (1)

4-4: Inconsistent main and module entry points.

Same issue as in the cat-fact-agent: the main field points to index.js while the module field points to index.ts.

Apply this diff to align the entry points:

-  "main": "index.js",
+  "main": "index.ts",

Also applies to: 36-36

🧹 Nitpick comments (30)
frameworks/mastra/blog-publisher/agentuity.yaml (2)

8-15: Add a project description.

An empty description (description: "") reduces discoverability and context for new contributors. Consider filling in a brief summary of the blog-publisher project's purpose.


71-76: Include agent metadata fields.

Consider adding a description (and any relevant tags or version) under the agents block to document the supervisor agent’s role.

agents/Startup_News_Scraper/biome.json (1)

24-27: Expand ignored files list.

Currently only .agentuity/** is ignored. It’s best practice to also ignore tool directories (e.g., .cursor/**) and common folders like node_modules/** and dist/** to prevent linting/formatting churn.

frameworks/mastra/blog-publisher/.editorconfig (1)

6-12: Harden editor settings.

  • trim_trailing_whitespace is false; enabling it helps avoid accidental whitespace diffs.
  • Setting insert_final_newline = true ensures POSIX-compliant files.
  • Since indent_style = tab, you may omit or set indent_size = tab to avoid confusion.
agents/Startup_News_Scraper/tsconfig.json (1)

1-24: Refine TS compiler configuration.

  • Add an explicit "include": ["src"] to limit compilation scope.
  • Extend the "exclude" array to ignore the .cursor directory.
  • Confirm whether "jsx": "react-jsx" is needed—remove or adjust it if you’re not using React.
frameworks/mastra/blog-publisher/src/agents/supervisor/agents.ts (1)

1-74: LGTM! Well-architected multi-agent system.

This implementation demonstrates excellent use of the supervisor pattern with proper separation of concerns. The use of different AI models for different roles (Claude for creative tasks, GPT-4o-mini for editing) is a smart design choice. Schema validation with Zod ensures type safety throughout the workflow.

Consider these optional improvements:

  1. Replace console.log with structured logging:
- console.log("🛠️ Copywriter tool executing...");
+ ctx.logger?.info("🛠️ Copywriter tool executing...");
  1. Add error handling in tool execution:
execute: async ({ context }) => {
+ try {
    console.log("🛠️ Copywriter tool executing...");
    // ... existing code
    return { copy: result.text };
+ } catch (error) {
+   throw new Error(`Copywriter tool failed: ${error.message}`);
+ }
},
frameworks/mastra/cat-fact-agent/index.ts (1)

3-9: Consider moving global interface extension to a type definition file.

The global NodeJS.Process interface extension would be better placed in a dedicated type definition file (e.g., types/global.d.ts) for better organization and reusability.

Create a new file types/global.d.ts:

declare global {
  namespace NodeJS {
    interface Process {
      isBun: boolean;
    }
  }
}

export {};

Then remove the global declaration from this file and add the types directory to your tsconfig.json.

agents/Startup_News_Scraper/src/agents/startup_scraper/types.ts (1)

8-16: Consider consistent nullable handling in StartupSummary interface.

The interface mixes optional properties (industry?) with explicit nullable types (summary: string | null). For consistency, consider using either optional properties or explicit nullable types throughout.

export interface StartupSummary {
  name: string;
  industry?: string; 
- summary: string | null;
+ summary?: string;
  founders?: string | null;
  why_it_matters?: string | null;
  funding_source?: string | null;
  source: string;
}

Or alternatively, make all optional fields explicitly nullable:

export interface StartupSummary {
  name: string;
- industry?: string; 
+ industry: string | null;
- summary: string | null;
+ summary: string | null;
- founders?: string | null;
+ founders: string | null;
- why_it_matters?: string | null;
+ why_it_matters: string | null;
- funding_source?: string | null;
+ funding_source: string | null;
  source: string;
}
agents/Startup_News_Scraper/index.ts (1)

3-9: Consider moving global type declaration to a separate declaration file.

The global type augmentation for NodeJS.Process interface is better placed in a global.d.ts or types.d.ts file for better organization and reusability.

Create a global.d.ts file:

declare global {
  namespace NodeJS {
    interface Process {
      isBun: boolean;
    }
  }
}

export {};
frameworks/mastra/cat-fact-agent/README.md (1)

13-13: Fix missing comma for better readability.

There's a missing comma that improves sentence flow and clarity.

-It demonstrates how a system prompt can shape an agent's personality and behavior in this case, turning the agent into a **verified cat expert** that always provides fun feline facts in its responses.
+It demonstrates how a system prompt can shape an agent's personality and behavior, in this case turning the agent into a **verified cat expert** that always provides fun feline facts in its responses.
frameworks/mastra/cat-fact-agent/src/agents/cat-agent/cat.ts (1)

12-19: Consider adding input validation schema even for parameterless tools.

While the tool doesn't require inputs, using a more explicit schema can improve clarity and future extensibility.

const catFact = createTool({
  id: "Get cat facts",
- inputSchema: z.object({}),          // no inputs
+ inputSchema: z.object({}), // No inputs required
  description: "Fetches cat facts",
  execute: async () => ({
    catFact: await getCatFact(),
  }),
});
agents/Startup_News_Scraper/src/agents/startup_scraper/fetchFeeds.ts (1)

6-12: Consider making the keyword list configurable.

The hardcoded KEEP keyword array could benefit from being configurable, especially for different deployment environments or user preferences.

-const KEEP = [
-  'startup', 'startups',
-  'ai', 'artificial intelligence',
-  'tech', 'technology',
-  'vc', 'venture capital',
-];
+const KEEP = process.env.STARTUP_KEYWORDS?.split(',') || [
+  'startup', 'startups',
+  'ai', 'artificial intelligence',
+  'tech', 'technology',
+  'vc', 'venture capital',
+];
agents/Startup_News_Scraper/n8n_workflow/workflow.json (1)

62-62: Consider extracting JavaScript code to a separate file.

The inline JavaScript code for HTML formatting is quite complex and would benefit from being extracted to a separate, testable file.

The current inline code could be moved to a module like:

// formatStartupDigest.js
function formatStartupDigest(startups) {
  let html = `
    <h2>🚀 Daily Startup Digest</h2>
    <p>Here are today's top startup highlights:</p>
  `;

  for (const s of startups) {
    html += `
      <hr>
      <h3>${s.name}</h3>
      <p><strong>Industry:</strong> ${s.industry || 'N/A'}</p>
      <p><strong>Summary:</strong><br>${s.summary}</p>
      ${s.why_it_matters ? `<p><strong>Why it matters:</strong><br>${s.why_it_matters}</p>` : ''}
      ${s.founders ? `<p><strong>Founders:</strong> ${s.founders}</p>` : ''}
      <p><strong>Source:</strong> <a href="${s.source}" target="_blank">${s.source}</a></p>
    `;
  }

  return html;
}
frameworks/mastra/blog-publisher/src/agents/supervisor/index.ts (1)

1-1: Incorrect file path comment.

The comment indicates this is src/index.ts but the actual file path is src/agents/supervisor/index.ts.

-// src/index.ts
+// src/agents/supervisor/index.ts
frameworks/mastra/blog-publisher/.cursor/rules/agent.mdc (1)

26-36: Interface descriptions could be more detailed.

The descriptions of AgentRequest, AgentResponse, and AgentContext are quite brief. Consider adding more specific details about available methods and common use cases.

Consider expanding the descriptions:

 ### AgentRequest

-The AgentRequest interface provides a set of helper methods and public variables which can be used for working with data has been passed to the Agent.
+The AgentRequest interface provides helper methods for accessing request data:
+- `data.text()` - Extract text content from the request
+- `data.json()` - Parse JSON from the request body
+- `headers` - Access HTTP headers
+- `query` - Access query parameters

 ### AgentResponse

-The AgentResponse interface provides a set of helper methods for responding with different data formats from the Agent.
+The AgentResponse interface provides methods for sending responses:
+- `resp.text(string)` - Send plain text response
+- `resp.json(object)` - Send JSON response
+- `resp.html(string)` - Send HTML response

 ### AgentContext

-The AgentContext has information specific to the incoming Agent request and a set of helper methods for accessing AI services like KeyValue storage and Vector storage.
+The AgentContext provides request-specific information and services:
+- `ctx.logger` - Structured logging interface
+- `ctx.kv` - Key-value storage access
+- `ctx.vector` - Vector database operations
+- Request metadata and environment information
agents/Startup_News_Scraper/.cursor/rules/agent.mdc (1)

26-36: Add more specific documentation for the interfaces.

While the interface descriptions are helpful, they could be more detailed. Consider adding specific examples of common use cases for each interface to help developers understand practical applications.

### AgentRequest

-The AgentRequest interface provides a set of helper methods and public variables which can be used for working with data has been passed to the Agent.
+The AgentRequest interface provides helper methods and properties for accessing request data, including JSON/text parsing, metadata extraction, and trigger information.

### AgentResponse

-The AgentResponse interface provides a set of helper methods for responding with different data formats from the Agent.
+The AgentResponse interface provides methods for creating various response types (JSON, text, HTML, binary) and agent handoffs.

### AgentContext

-The AgentContext has information specific to the incoming Agent request and a set of helper methods for accessing AI services like KeyValue storage and Vector storage.
+The AgentContext provides access to logging, key-value storage, vector storage, remote agents, and tracing capabilities for the current request.
agents/Startup_News_Scraper/src/agents/startup_scraper/index.ts (2)

12-15: Consider adding return type annotation.

The welcome function should have an explicit return type for better type safety and documentation.

-export const welcome = () => ({
+export const welcome = (): { welcome: string } => ({
   welcome:
     'POST {} (or {"perFeed":3}) to receive the three freshest startup articles from each feed, summarized.',
 });

27-32: Add input validation for perFeed parameter.

Consider adding validation to ensure perFeed is a reasonable positive integer to prevent potential issues downstream.

     const perFeed = body.perFeed ?? 3;            // ← new default
+    
+    // Validate perFeed parameter
+    if (typeof perFeed !== 'number' || perFeed < 1 || perFeed > 50) {
+      ctx.logger.warn('Invalid perFeed value %s, using default of 3', perFeed);
+      perFeed = 3;
+    }
agents/Startup_News_Scraper/README.md (5)

70-70: Add missing comma for better readability.

There's a missing comma that makes the sentence harder to parse.

-1. In your **Agentuity** dashboard open the deployed agent, click the **➕** icon under *IO Visualization* and choose **API**.
+1. In your **Agentuity** dashboard, open the deployed agent, click the **➕** icon under *IO Visualization* and choose **API**.

83-84: Fix duplicated word in JSON description.

The word "JSON" appears twice in the description.

-    - Body Content Type – select **JSON**
-    - JSON Body – `{}`  (a single empty JSON object)
+    - Body Content Type – select **JSON**
+    - Body – `{}`  (a single empty JSON object)

87-89: Fix section heading repetition.

The phrase "Code Node" is repeated unnecessarily in the heading and first line.

-### 6. Do not adjust Code Node
-1. Code node is preconfigured with the logic to transform the JSON formatted summaries to human-readable HTML.
+### 6. Do not adjust Code Node
+1. This node is preconfigured with the logic to transform the JSON formatted summaries to human-readable HTML.

91-91: Consider hyphenating compound adjective.

"Third Party" should be hyphenated when used as a compound adjective.

-### 7. Third Party Configuration (Email, Slack, Discord, etc.)
+### 7. Third-Party Configuration (Email, Slack, Discord, etc.)

51-56: Verify package manager consistency.

The setup instructions use bun commands, but this might not be available in all environments. Consider providing alternative commands for npm/yarn users.

 ```bash
 git clone https://github.com/agentuity/examples
 cd agents/Startup_News_Scraper
 bun install
 bun dev
+# Or using npm:
+# npm install
+# npm run dev

</blockquote></details>
<details>
<summary>frameworks/mastra/blog-publisher/.cursor/rules/sdk.mdc (2)</summary><blockquote>

`1-5`: **Consider enabling alwaysApply for consistent SDK reference.**

The `alwaysApply: false` setting might limit the usefulness of this SDK reference. Consider enabling it for consistent access to SDK documentation.


```diff
 ---
 description: Agentuity JavaScript SDK API Reference
 globs: "src/agents/**/*.ts"
-alwaysApply: false
+alwaysApply: true
 ---

17-23: Add return type information to AgentHandler.

The AgentResponseType is referenced but not defined. Consider adding more context about what this type represents.

 ```typescript
 type AgentHandler = (
   request: AgentRequest,
   response: AgentResponse,
   context: AgentContext
-) => Promise<AgentResponseType>;
+) => Promise<AgentResponseType>; // AgentResponseType represents the response from any response method

</blockquote></details>
<details>
<summary>agents/Startup_News_Scraper/src/agents/startup_scraper/summarize.ts (3)</summary><blockquote>

`19-24`: **Consider logging failed summaries for debugging.**

While using `Promise.allSettled` is correct for handling partial failures, consider logging rejected promises to aid debugging.



```diff
 for (const group of chunks) {
   const settled = await Promise.allSettled(group.map(callOpenAI));
   for (const res of settled) {
-    if (res.status === 'fulfilled') summaries.push(res.value);
+    if (res.status === 'fulfilled') {
+      summaries.push(res.value);
+    } else {
+      console.warn('Failed to summarize startup:', res.reason);
+    }
   }
 }

44-51: Consider adding retry logic and rate limiting.

OpenAI API calls can fail due to rate limits or temporary issues. Consider implementing exponential backoff retry logic.

You may want to add retry logic and potentially adjust the temperature and token limits based on your needs:

+const MAX_RETRIES = 3;
+const RETRY_DELAY = 1000; // 1 second base delay

+async function callOpenAIWithRetry(link: StartupLink, retries = 0): Promise<StartupSummary> {
+  try {
     const res = await openai.chat.completions.create({
       model: 'gpt-4o-mini',
       messages: [{ role: 'user', content: prompt }],
       response_format: { type: 'json_object' },
-      max_tokens: 400,
-      temperature: 0.4,
+      max_tokens: 500, // Slightly higher for comprehensive summaries
+      temperature: 0.2, // Lower for more consistent output
     });
+  } catch (error) {
+    if (retries < MAX_RETRIES && (error.status === 429 || error.status >= 500)) {
+      await new Promise(resolve => setTimeout(resolve, RETRY_DELAY * Math.pow(2, retries)));
+      return callOpenAIWithRetry(link, retries + 1);
+    }
+    throw error;
+  }

76-84: Add return type annotation and improve regex patterns.

The function should have explicit return type annotation, and consider making regex patterns more precise.

-function normaliseIndustry(raw?: string): 'AI' | 'VC' | 'Tech' | 'Startups' | undefined {
+function normaliseIndustry(raw?: string): 'AI' | 'VC' | 'Tech' | 'Startups' {
     if (!raw) return undefined;
     const t = raw.toLowerCase();
-    if (/(^| )(ai|artificial intelligence|machine learning|ml)( |$)/.test(t)) { return 'AI';}
-    if (/(vc|venture|fund|capital|investor)/.test(t)) { return 'VC';}
-    if (/(startup|accelerator|incubator|founder program)/.test(t)) { return 'Startups';}
-    if (/(tech|technology|robot|drone|fintech|crypto|software|hardware|cloud|SaaS)/.test(t)) { return 'Tech';}
-    return undefined;
+    if (/\b(ai|artificial intelligence|machine learning|ml|llm|gpt)\b/.test(t)) return 'AI';
+    if (/\b(vc|venture|fund|capital|investor|investment)\b/.test(t)) return 'VC';
+    if (/\b(startup|accelerator|incubator|founder program|entrepreneurship)\b/.test(t)) return 'Startups';
+    if (/\b(tech|technology|robot|drone|fintech|crypto|software|hardware|cloud|saas|platform)\b/i.test(t)) return 'Tech';
+    return 'Tech'; // Default fallback instead of undefined
   }
frameworks/mastra/cat-fact-agent/.cursor/rules/sdk.mdc (2)

17-23: Consider adding parameter descriptions to AgentHandler type.

The type signature is correct, but adding brief parameter descriptions would improve clarity.

 type AgentHandler = (
-  request: AgentRequest,
-  response: AgentResponse,
-  context: AgentContext
+  request: AgentRequest,    // Incoming request data and metadata
+  response: AgentResponse,  // Response builder methods
+  context: AgentContext     // Runtime context (logging, storage, etc.)
 ) => Promise<AgentResponseType>;

88-96: Enhance best practices with specific examples.

The best practices section could benefit from concrete examples and more detailed guidance.

Consider expanding the best practices section:

 ## Best Practices

 - Use TypeScript for better type safety and IDE support
 - Import types from `@agentuity/sdk`
 - Use structured error handling with try/catch blocks
 - Leverage the provided logger for consistent logging
 - Use the storage APIs for persisting data
 - Consider agent communication for complex workflows
+
+### Example Usage
+
+```typescript
+import type { AgentHandler } from '@agentuity/sdk';
+
+const handler: AgentHandler = async (request, response, context) => {
+  try {
+    const data = await request.data.json();
+    context.logger.info('Processing request', { data });
+    
+    // Your agent logic here
+    
+    return response.json({ success: true });
+  } catch (error) {
+    context.logger.error('Agent error', error);
+    return response.json({ error: 'Internal error' }, { status: 500 });
+  }
+};
+```
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfe41a0 and 527a8ba.

⛔ Files ignored due to path filters (3)
  • agents/Startup_News_Scraper/bun.lock is excluded by !**/*.lock
  • frameworks/mastra/blog-publisher/bun.lock is excluded by !**/*.lock
  • frameworks/mastra/cat-fact-agent/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (42)
  • agents/Startup_News_Scraper/.cursor/rules/agent.mdc (1 hunks)
  • agents/Startup_News_Scraper/.cursor/rules/agentuity.mdc (1 hunks)
  • agents/Startup_News_Scraper/.cursor/rules/sdk.mdc (1 hunks)
  • agents/Startup_News_Scraper/.editorconfig (1 hunks)
  • agents/Startup_News_Scraper/.gitignore (1 hunks)
  • agents/Startup_News_Scraper/README.md (1 hunks)
  • agents/Startup_News_Scraper/agentuity.yaml (1 hunks)
  • agents/Startup_News_Scraper/biome.json (1 hunks)
  • agents/Startup_News_Scraper/index.ts (1 hunks)
  • agents/Startup_News_Scraper/n8n_workflow/workflow.json (1 hunks)
  • agents/Startup_News_Scraper/package.json (1 hunks)
  • agents/Startup_News_Scraper/src/agents/startup_scraper/fetchFeeds.ts (1 hunks)
  • agents/Startup_News_Scraper/src/agents/startup_scraper/index.ts (1 hunks)
  • agents/Startup_News_Scraper/src/agents/startup_scraper/summarize.ts (1 hunks)
  • agents/Startup_News_Scraper/src/agents/startup_scraper/types.ts (1 hunks)
  • agents/Startup_News_Scraper/tsconfig.json (1 hunks)
  • frameworks/mastra/blog-publisher/.cursor/rules/agent.mdc (1 hunks)
  • frameworks/mastra/blog-publisher/.cursor/rules/agentuity.mdc (1 hunks)
  • frameworks/mastra/blog-publisher/.cursor/rules/sdk.mdc (1 hunks)
  • frameworks/mastra/blog-publisher/.editorconfig (1 hunks)
  • frameworks/mastra/blog-publisher/.gitignore (1 hunks)
  • frameworks/mastra/blog-publisher/README.md (1 hunks)
  • frameworks/mastra/blog-publisher/agentuity.yaml (1 hunks)
  • frameworks/mastra/blog-publisher/biome.json (1 hunks)
  • frameworks/mastra/blog-publisher/index.ts (1 hunks)
  • frameworks/mastra/blog-publisher/package.json (1 hunks)
  • frameworks/mastra/blog-publisher/src/agents/supervisor/agents.ts (1 hunks)
  • frameworks/mastra/blog-publisher/src/agents/supervisor/index.ts (1 hunks)
  • frameworks/mastra/blog-publisher/tsconfig.json (1 hunks)
  • frameworks/mastra/cat-fact-agent/.cursor/rules/agent.mdc (1 hunks)
  • frameworks/mastra/cat-fact-agent/.cursor/rules/agentuity.mdc (1 hunks)
  • frameworks/mastra/cat-fact-agent/.cursor/rules/sdk.mdc (1 hunks)
  • frameworks/mastra/cat-fact-agent/.editorconfig (1 hunks)
  • frameworks/mastra/cat-fact-agent/.gitignore (1 hunks)
  • frameworks/mastra/cat-fact-agent/README.md (1 hunks)
  • frameworks/mastra/cat-fact-agent/agentuity.yaml (1 hunks)
  • frameworks/mastra/cat-fact-agent/biome.json (1 hunks)
  • frameworks/mastra/cat-fact-agent/index.ts (1 hunks)
  • frameworks/mastra/cat-fact-agent/package.json (1 hunks)
  • frameworks/mastra/cat-fact-agent/src/agents/cat-agent/cat.ts (1 hunks)
  • frameworks/mastra/cat-fact-agent/src/agents/cat-agent/index.ts (1 hunks)
  • frameworks/mastra/cat-fact-agent/tsconfig.json (1 hunks)
🧰 Additional context used
🪛 LanguageTool
frameworks/mastra/cat-fact-agent/README.md

[uncategorized] ~13-~13: Possible missing comma found.
Context: ...pt can shape an agent's personality and behavior in this case, turning the agent into a ...

(AI_HYDRA_LEO_MISSING_COMMA)

agents/Startup_News_Scraper/README.md

[uncategorized] ~70-~70: A comma might be missing here.
Context: ...y API endpoint 1. In your Agentuity dashboard open the deployed agent, click the *...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)


[duplication] ~83-~83: Possible typo: you repeated a word.
Context: ...on** - Body Content Type – select JSON - JSON Body – {} (a single empty JSON objec...

(ENGLISH_WORD_REPEAT_RULE)


[grammar] ~87-~87: This phrase is duplicated. You should probably use “Code Node” only once.
Context: ...– leave blank ### 6. Do not adjust Code Node 1. Code node is preconfigured with the logic to tran...

(PHRASE_REPETITION)


[uncategorized] ~91-~91: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...eadable HTML. 2. Do not change. ### 7. Third Party Configuration (Email, Slack, Discord, e...

(EN_COMPOUND_ADJECTIVE_INTERNAL)

🔇 Additional comments (54)
frameworks/mastra/cat-fact-agent/.cursor/rules/agentuity.mdc (2)

1-5: Front matter is correctly configured. The YAML header defines the description, file globs, and enforcement flag consistently with other Agentuity rule files.


7-9: Directive is clear. The notice not to suggest edits is appropriate for generated config files and prevents accidental modifications.

agents/Startup_News_Scraper/.editorconfig (1)

1-12: Consistent EditorConfig settings. Defining this as the root ensures tab-based indentation (size 2), LF line endings, UTF-8 charset, and controlled whitespace handling—matching the style of other agent projects.

frameworks/mastra/blog-publisher/biome.json (1)

1-27: Biome configuration aligns with standards. The schema version, import organization, linting rules, formatter settings (2-space indent, single quotes, semicolons), and ignored paths mirror other agent frameworks.

frameworks/mastra/cat-fact-agent/.editorconfig (1)

1-12: EditorConfig matches project conventions. Root declaration, tab indentation, LF endings, and UTF-8 encoding ensure consistency across this agent’s files.

frameworks/mastra/cat-fact-agent/biome.json (1)

1-27: Biome setup is correct. The JSON config enables import organization, recommended linting, formatting rules, and excludes .agentuity files, consistent with other agent projects.

frameworks/mastra/blog-publisher/.cursor/rules/agentuity.mdc (1)

1-9: Guidelines schema is correct
The front-matter metadata and instructional text clearly document the agentuity.yaml configuration. No edits needed.

agents/Startup_News_Scraper/.gitignore (1)

1-40: .gitignore covers all transient and build artifacts
Patterns for dependencies, outputs, coverage, logs, environment files, caches, IDE settings, macOS metadata, and Agentuity files are comprehensive and consistent.

frameworks/mastra/cat-fact-agent/.gitignore (1)

1-40: .gitignore is thorough and consistent
Matches the structure used in other agent projects; no gaps detected.

frameworks/mastra/blog-publisher/tsconfig.json (1)

1-24: tsconfig aligns with project conventions
Strict settings and module options match other Agentuity projects. Verify that your TypeScript toolchain is v5.0+ to support allowImportingTsExtensions and verbatimModuleSyntax.

frameworks/mastra/blog-publisher/.gitignore (1)

1-40: .gitignore is well-structured and consistent
All expected directories and file types (node_modules, build outputs, coverage, env files, caches, IDE/OS files, Agentuity metadata) are properly excluded.

frameworks/mastra/blog-publisher/agentuity.yaml (1)

50-57: Verify CPU resource unit.

You’ve specified cpu: 500M, but most Kubernetes-style configs expect millicores as 500m (lowercase m). Please confirm with the Agentuity schema or change to 500m to avoid unintended resource limits.

agents/Startup_News_Scraper/.cursor/rules/agentuity.mdc (1)

1-10: Configuration rule header looks good.

The frontmatter and guidance correctly target agentuity.yaml and enforce the rule. No changes needed.

frameworks/mastra/cat-fact-agent/tsconfig.json (1)

1-24: LGTM! Well-configured TypeScript setup.

The configuration follows modern TypeScript best practices with strict type checking, ESNext targeting, and appropriate bundler module resolution. The inclusion of @agentuity/sdk types and exclusion of build directories are properly configured.

agents/Startup_News_Scraper/package.json (1)

1-35: LGTM! Well-structured package configuration.

The package.json follows best practices with appropriate scripts, dependencies, and tooling setup. The use of Biome for formatting/linting and Bun runtime is modern and efficient.

However, please verify that the dependency versions are current and secure, particularly the Agentuity SDK version.

#!/bin/bash
# Description: Check for latest versions and security advisories for key dependencies

echo "Checking Agentuity SDK version..."
npm view @agentuity/sdk version

echo "Checking OpenAI SDK version..."
npm view openai version

echo "Checking RSS parser version..."
npm view rss-parser version

echo "Checking for security advisories..."
npm audit --audit-level=moderate --json | jq '.vulnerabilities | length'
agents/Startup_News_Scraper/agentuity.yaml (1)

1-76: LGTM! Comprehensive configuration with good security practices.

The Agentuity configuration is well-structured with appropriate development and deployment settings. Particularly noteworthy are the security-focused deployment flags like --disallow-code-generation-from-strings, --no-addons, and --no-macros which enhance runtime security.

The resource limits and file watching configuration are also appropriately set for the project needs.

frameworks/mastra/cat-fact-agent/src/agents/cat-agent/index.ts (1)

1-21: LGTM! Clean and well-structured agent implementation.

This agent follows Agentuity best practices with proper type usage, comprehensive error handling, and user-friendly responses. The fallback to a default prompt and the welcome function provide good user experience. The error handling appropriately logs technical details while returning a friendly message to users.

frameworks/mastra/cat-fact-agent/package.json (1)

30-34: Verify dependency version compatibility.

Ensure all dependency versions are compatible and up-to-date, particularly for the SDK and AI-related packages.

#!/bin/bash
# Check for the latest versions of key dependencies
echo "Checking latest versions..."
npm view @agentuity/sdk version
npm view @ai-sdk/openai version
npm view @mastra/core version
npm view openai version
frameworks/mastra/cat-fact-agent/index.ts (2)

11-25: LGTM! Comprehensive environment validation.

The environment validation logic properly checks for required API keys and provides helpful error messages with runtime-specific instructions.


43-52: Good error handling in the runner.

The catch block appropriately handles both Error instances and other types of exceptions, providing detailed error information before exiting.

agents/Startup_News_Scraper/.cursor/rules/sdk.mdc (1)

88-97: LGTM! Excellent best practices section.

The best practices section provides valuable guidance for SDK usage, covering TypeScript, error handling, logging, and storage recommendations.

frameworks/mastra/blog-publisher/package.json (2)

29-35: Good dependency selection for blog publishing functionality.

The addition of @ai-sdk/anthropic alongside OpenAI dependencies provides flexibility for different AI models in blog publishing workflows.


6-13: Consistent script configuration across agent projects.

The npm scripts follow the same pattern as other agents in the repository, ensuring consistency in development workflows.

frameworks/mastra/blog-publisher/README.md (1)

1-118: Well-structured documentation with clear setup instructions.

The README provides comprehensive documentation for the Blog-Publisher agent with proper structure, clear prerequisites, and step-by-step instructions. The hierarchical multi-agent workflow is well explained.

agents/Startup_News_Scraper/index.ts (1)

43-43: Verify Node.js version requirement for import.meta.dirname.

The import.meta.dirname is only available in Node.js 20.11+ and ESM modules. Ensure your project specifies the minimum Node.js version requirement in package.json.

#!/bin/bash
# Check if package.json specifies minimum Node.js version
fd "package.json" --exec cat {} | jq '.engines.node // "not specified"'
frameworks/mastra/cat-fact-agent/README.md (1)

1-118: Comprehensive documentation with clear agent workflow explanation.

The README effectively explains the Cat-Fact-Agent's purpose, system prompt usage, and tool integration. The documentation structure is consistent with other agents in the project.

frameworks/mastra/cat-fact-agent/src/agents/cat-agent/cat.ts (2)

22-31: Well-designed system prompt with clear responsibilities.

The system prompt effectively guides the agent's behavior and ensures consistent use of the cat fact tool in responses.


34-39: Agent configuration looks good with appropriate model selection.

The agent is properly configured with GPT-4o-mini model and integrates the custom cat fact tool effectively.

agents/Startup_News_Scraper/src/agents/startup_scraper/fetchFeeds.ts (2)

25-34: Good error handling for RSS feed parsing.

The concurrent fetching with proper error handling ensures that failures in individual feeds don't break the entire operation. The warning logs will help with debugging feed issues.


39-49: Robust filtering and data processing logic.

The implementation correctly handles:

  • Missing feed data with null checks
  • Filtering items with required fields (title, link)
  • Keyword matching in both title and content
  • Limiting results per feed
  • Safe non-null assertions after filtering
frameworks/mastra/cat-fact-agent/agentuity.yaml (3)

51-57: Resource allocation is appropriate for a simple agent.

The memory (350Mi), CPU (500M), and disk (250Mi) allocations are reasonable for a cat fact agent. These conservative limits help prevent resource overconsumption.


36-49: Excellent security-focused deployment configuration.

The deployment args include comprehensive security flags:

  • --no-macros and --disallow-code-generation-from-strings prevent code injection
  • --no-addons reduces attack surface
  • --report-uncaught-exception improves error visibility
  • --no-global-search-paths limits file system access

66-69: Verify ignore patterns align with bundler requirements.

The ignore patterns include src/** which seems counterintuitive since agents are typically in the src directory. Ensure this doesn't interfere with agent bundling.

#!/bin/bash
# Description: Check if similar ignore patterns exist in other agentuity.yaml files
# Expected: Consistent patterns across agent projects

echo "Checking ignore patterns in other agentuity.yaml files:"
fd -e yaml -x grep -H -A5 -B5 "ignore:" {} \;
agents/Startup_News_Scraper/n8n_workflow/workflow.json (1)

163-163: Workflow is inactive by default.

The workflow is set to "active": false, which means it won't run automatically despite having a schedule trigger.

Verify if this is intentional or if the workflow should be activated for production use.

frameworks/mastra/blog-publisher/src/agents/supervisor/index.ts (2)

14-16: Good input validation and user feedback.

The topic extraction and validation provide clear feedback to users when no topic is provided.


32-35: Appropriate error handling with logging.

The error handling correctly logs errors for debugging while providing a user-friendly error message.

frameworks/mastra/blog-publisher/.cursor/rules/agent.mdc (1)

18-24: Example agent code follows best practices.

The example demonstrates proper TypeScript usage, correct imports from the SDK, and appropriate function signature.

agents/Startup_News_Scraper/.cursor/rules/agent.mdc (3)

1-5: LGTM! Well-structured frontmatter configuration.

The YAML frontmatter correctly configures the cursor rules with appropriate description, glob pattern for TypeScript agent files, and the alwaysApply: true setting for consistent enforcement.


9-15: Clear and comprehensive guidelines.

The guidelines provide essential best practices for agent development, including proper SDK usage, naming conventions, TypeScript requirements, and logging patterns. The recommendation to use the agentuity agent create command promotes consistency.


18-24: Verify the example agent implementation.

The example demonstrates proper TypeScript imports and function structure. However, I notice potential issues that should be verified:

#!/bin/bash
# Verify that the example agent code matches the actual SDK API
ast-grep --pattern $'export default async function $FUNC_NAME($REQ: AgentRequest, $RESP: AgentResponse, $CTX: AgentContext) {
  $$$
}'
agents/Startup_News_Scraper/src/agents/startup_scraper/index.ts (1)

7-10: LGTM! Proper SDK imports and module structure.

The imports correctly use the Agentuity SDK types and follow the guidelines established in the cursor rules. The local module imports are well-organized and maintain clear separation of concerns.

frameworks/mastra/blog-publisher/index.ts (5)

3-9: LGTM! Proper global interface augmentation.

The global interface declaration for adding the isBun property to the NodeJS Process interface is correctly implemented and follows TypeScript best practices.


11-25: Well-implemented environment validation with clear error messaging.

The validation logic properly checks for required API keys and provides helpful error messages with colored output. The conditional advice for Node.js users is a nice touch for developer experience.


27-41: Good warning system for local development.

The warnings for missing AGENTUITY_URL are helpful and provide appropriate guidance based on the runtime environment (Bun vs Node.js). The colored output enhances visibility.


43-52: Robust error handling for the runner function.

The error handling properly distinguishes between Error instances and other types, provides stack traces when available, and ensures proper process exit codes.


43-43: Verify import.meta.dirname usage.

The usage of import.meta.dirname should be verified as it's a relatively new Node.js feature and may not be available in all environments.

Is import.meta.dirname supported in Node.js and what is the minimum version required?
agents/Startup_News_Scraper/README.md (2)

1-12: Excellent introduction with clear branding and purpose.

The README starts with a professional header that clearly explains the project's purpose. The Agentuity branding and deploy button provide good visual appeal and immediate action items.


126-127: Verify documentation links are accessible.

The documentation links should be verified to ensure they're publicly accessible and contain the expected content.

#!/bin/bash
# Verify that the documentation URLs are accessible
curl -I https://agentuity.dev/SDKs/javascript 2>/dev/null | head -1
frameworks/mastra/blog-publisher/.cursor/rules/sdk.mdc (3)

88-96: Excellent best practices section.

The best practices provide valuable guidance for developers, covering type safety, error handling, logging, and architectural considerations. This adds significant value to the documentation.


97-97: Verify documentation URL accessibility.

The SDK documentation link should be verified to ensure it's publicly accessible.

#!/bin/bash
# Verify that the SDK documentation URL is accessible
curl -I https://agentuity.dev/SDKs/javascript/api-reference 2>/dev/null | head -1

33-37: To confirm whether both methods actually exist (or if this is just a docs issue), let’s locate the real AgentRequest definition and its data methods:

#!/bin/bash
# 1. Find where AgentRequest is defined
rg "export (interface|type) AgentRequest" -n

# 2. If found, show its data block to check for both methods
rg -A5 -B2 "AgentRequest" -n --glob "*.ts"

# 3. Search globally for buffer() and binary() return signatures
rg -C3 "buffer(): *Promise" -n
rg -C3 "binary(): *Promise" -n
agents/Startup_News_Scraper/src/agents/startup_scraper/summarize.ts (2)

4-4: Verify OpenAI API key configuration.

The OpenAI client initialization relies on process.env.OPENAI_API_KEY without validation. Consider adding explicit error handling if the API key is missing.

-const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
+const openai = new OpenAI({ 
+  apiKey: process.env.OPENAI_API_KEY || (() => {
+    throw new Error('OPENAI_API_KEY environment variable is required');
+  })()
+});

11-15: LGTM! Clean chunk-based concurrency implementation.

The array chunking logic for batching API requests is well-implemented and will help manage rate limits effectively.

frameworks/mastra/cat-fact-agent/.cursor/rules/sdk.mdc (1)

1-5: LGTM! Well-structured cursor rules metadata.

The YAML frontmatter is properly configured with appropriate description, glob patterns, and conditional application settings.

Comment on lines +66 to +69
ignore:
- node_modules/**
- dist/**
- src/**
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

Remove src/** from bundler ignore.

Ignoring the entire src/ directory will also exclude your agent source files (src/agents). Update to ignore only build artifacts (e.g., node_modules and dist) but keep src/agents included.

Apply this diff:

 bundler:
   ignore:
-    - node_modules/**
-    - dist/**
-    - src/**
+    - node_modules/**
+    - dist/**
📝 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
ignore:
- node_modules/**
- dist/**
- src/**
ignore:
- node_modules/**
- dist/**
🤖 Prompt for AI Agents
In frameworks/mastra/blog-publisher/agentuity.yaml around lines 66 to 69, the
bundler ignore list currently excludes the entire src/ directory, which
unintentionally excludes your agent source files in src/agents. Modify the
ignore list to remove src/** and only ignore build artifacts like
node_modules/** and dist/**, ensuring that src/agents remains included in the
bundle.

{
"name": "cat-fact-agent",
"version": "0.0.1",
"main": "index.js",
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

Inconsistent main and module entry points.

The main field points to index.js while the module field points to index.ts. This inconsistency could cause module resolution issues.

Apply this diff to align the entry points:

-  "main": "index.js",
+  "main": "index.ts",

Also applies to: 35-35

🤖 Prompt for AI Agents
In frameworks/mastra/cat-fact-agent/package.json at line 4 and line 35, the
"main" field points to "index.js" while the "module" field points to "index.ts",
causing inconsistency in entry points. To fix this, update the "module" field to
point to "index.js" to match the "main" field or change both fields to
consistently point to the same compiled JavaScript file, ensuring consistent
module resolution.

Comment on lines +7 to +10
const getCatFact = async () => {
const { fact } = (await fetch("https://catfact.ninja/fact").then(r => r.json())) as { fact: string };
return fact;
};
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

Add error handling and response validation for external API call.

The fetch operation lacks error handling and doesn't validate the API response structure, which could cause runtime failures.

const getCatFact = async () => {
- const { fact } = (await fetch("https://catfact.ninja/fact").then(r => r.json())) as { fact: string };
- return fact;
+ try {
+   const response = await fetch("https://catfact.ninja/fact");
+   if (!response.ok) {
+     throw new Error(`API request failed: ${response.status}`);
+   }
+   const data = await response.json();
+   if (!data || typeof data.fact !== 'string') {
+     throw new Error('Invalid API response format');
+   }
+   return data.fact;
+ } catch (error) {
+   console.error('Failed to fetch cat fact:', error);
+   return 'Did you know cats have been domesticated for over 4,000 years?'; // Fallback fact
+ }
};
📝 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 getCatFact = async () => {
const { fact } = (await fetch("https://catfact.ninja/fact").then(r => r.json())) as { fact: string };
return fact;
};
const getCatFact = async () => {
try {
const response = await fetch("https://catfact.ninja/fact");
if (!response.ok) {
throw new Error(`API request failed: ${response.status}`);
}
const data = await response.json();
if (!data || typeof data.fact !== 'string') {
throw new Error('Invalid API response format');
}
return data.fact;
} catch (error) {
console.error('Failed to fetch cat fact:', error);
return 'Did you know cats have been domesticated for over 4,000 years?'; // Fallback fact
}
};
🤖 Prompt for AI Agents
In frameworks/mastra/cat-fact-agent/src/agents/cat-agent/cat.ts around lines 7
to 10, the getCatFact function lacks error handling and does not validate the
API response structure. To fix this, wrap the fetch call in a try-catch block to
handle potential network or parsing errors, and add checks to ensure the
response contains the expected 'fact' property before returning it. If the
validation fails, handle the error gracefully, possibly by returning a default
value or throwing a descriptive error.

Comment on lines 93 to 102
"guildId": {
"__rl": true,
"mode": "list",
"value": ""
},
"channelId": {
"__rl": true,
"mode": "list",
"value": ""
},
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

Discord configuration has empty values.

The Discord node has empty guildId and channelId values, which will prevent the workflow from working correctly.

Populate the Discord configuration with actual values:

 "guildId": {
   "__rl": true,
   "mode": "list",
-  "value": ""
+  "value": "your-discord-guild-id"
 },
 "channelId": {
   "__rl": true,
   "mode": "list",
-  "value": ""
+  "value": "your-discord-channel-id"
 },
🤖 Prompt for AI Agents
In agents/Startup_News_Scraper/n8n_workflow/workflow.json around lines 93 to
102, the Discord node configuration has empty strings for the guildId and
channelId fields. Replace these empty values with the actual Discord guild ID
and channel ID to ensure the workflow can connect and operate correctly within
the intended Discord server and channel.

Comment on lines 24 to 35
"parameters": {
"method": "POST",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-440,
180
],
"id": "a1f3a427-c810-49d6-b3c6-dd1ce4fdda16",
"name": "HTTP Request"
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

Missing HTTP request URL configuration.

The HTTP Request node lacks a URL parameter, which means it won't know where to send the POST request to the startup scraper agent.

Add the URL parameter to the HTTP Request node:

 "parameters": {
   "method": "POST",
+  "url": "https://your-agentuity-deployment-url.com/agent/startup_scraper",
   "options": {}
 },
📝 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
"parameters": {
"method": "POST",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-440,
180
],
"id": "a1f3a427-c810-49d6-b3c6-dd1ce4fdda16",
"name": "HTTP Request"
"parameters": {
"method": "POST",
"url": "https://your-agentuity-deployment-url.com/agent/startup_scraper",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
-440,
180
],
"id": "a1f3a427-c810-49d6-b3c6-dd1ce4fdda16",
"name": "HTTP Request"
🤖 Prompt for AI Agents
In agents/Startup_News_Scraper/n8n_workflow/workflow.json around lines 24 to 35,
the HTTP Request node is missing the URL parameter, so it does not know the
endpoint to send the POST request. Add a "url" field inside the "parameters"
object with the correct endpoint URL string to specify where the request should
be sent.

Comment on lines 53 to 59
const raw = res.choices?.[0]?.message?.content ?? '{}';
let parsed: any = {};
try {
parsed = JSON.parse(raw);
} catch {
parsed = {};
}
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

Improve JSON parsing error handling.

The empty catch block silently swallows parsing errors. Consider logging the parsing failure for debugging.

 const raw = res.choices?.[0]?.message?.content ?? '{}';
 let parsed: any = {};
 try {
   parsed = JSON.parse(raw);
-} catch {
+} catch (error) {
+  console.warn('Failed to parse OpenAI response as JSON:', { raw, error: error.message, url: link.url });
   parsed = {};
 }
📝 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 raw = res.choices?.[0]?.message?.content ?? '{}';
let parsed: any = {};
try {
parsed = JSON.parse(raw);
} catch {
parsed = {};
}
const raw = res.choices?.[0]?.message?.content ?? '{}';
let parsed: any = {};
try {
parsed = JSON.parse(raw);
} catch (error) {
console.warn('Failed to parse OpenAI response as JSON:', {
raw,
error: error.message,
url: link.url,
});
parsed = {};
}
🤖 Prompt for AI Agents
In agents/Startup_News_Scraper/src/agents/startup_scraper/summarize.ts around
lines 53 to 59, the JSON parsing error is caught with an empty catch block,
which hides parsing issues. Modify the catch block to log the error details
using an appropriate logger or console.error to provide visibility into parsing
failures for easier debugging.

Comment on lines 31 to 42
const prompt = `You are a venture-capital analyst writing deal briefs.

Read the article at:
${link.url}

Return a single **JSON object** with these keys ⬇︎
- name
- industry
- summary – 2-4 sentences, 60-120 words, plain text
- founders – null if unknown
- why_it_matters – 1-2 sentences on strategic significance, null if unknown
- funding_source – null if not mentioned`;
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

Improve prompt clarity and add URL validation.

The prompt could be more explicit about expected JSON structure, and consider validating the URL before sending to OpenAI.

+  // Basic URL validation
+  if (!link.url || !link.url.startsWith('http')) {
+    throw new Error(`Invalid URL: ${link.url}`);
+  }
+
   const prompt = `You are a venture-capital analyst writing deal briefs.

 Read the article at:
 ${link.url}

-Return a single **JSON object** with these keys ⬇︎
+Return a single JSON object with exactly these keys (use null for unknown values):
+{
+  "name": "string - company name",
+  "industry": "string - industry category", 
+  "summary": "string - 2-4 sentences, 60-120 words",
+  "founders": "string or null - founder names",
+  "why_it_matters": "string or null - strategic significance",
+  "funding_source": "string or null - funding details"
+}`;
📝 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 prompt = `You are a venture-capital analyst writing deal briefs.
Read the article at:
${link.url}
Return a single **JSON object** with these keys ⬇︎
- name
- industry
- summary 2-4 sentences, 60-120 words, plain text
- founders null if unknown
- why_it_matters 1-2 sentences on strategic significance, null if unknown
- funding_source null if not mentioned`;
// Basic URL validation
if (!link.url || !link.url.startsWith('http')) {
throw new Error(`Invalid URL: ${link.url}`);
}
const prompt = `You are a venture-capital analyst writing deal briefs.
Read the article at:
${link.url}
Return a single JSON object with exactly these keys (use null for unknown values):
{
"name": "string - company name",
"industry": "string - industry category",
"summary": "string - 2-4 sentences, 60-120 words",
"founders": "string or null - founder names",
"why_it_matters": "string or null - strategic significance",
"funding_source": "string or null - funding details"
}`;
🤖 Prompt for AI Agents
In agents/Startup_News_Scraper/src/agents/startup_scraper/summarize.ts around
lines 31 to 42, improve the prompt by explicitly specifying the expected JSON
format, including data types and example values for each key to enhance clarity.
Additionally, add a URL validation step before using link.url in the prompt to
ensure it is a valid URL, preventing malformed inputs from being sent to OpenAI.

Comment on lines +32 to +37
- `request.data.contentType`: Gets the content type of the request payload
- `request.data.json(): Promise<Json>`: Gets the payload as a JSON object
- `request.data.text(): Promise<string>`: Gets the payload as a string
- `request.data.buffer(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.binary(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.object<T>: Promise<T>`: Gets the payload as a typed object
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 inconsistent method signatures.

The documentation shows inconsistent method names and signatures. Some methods use different naming patterns.

 - `request.data.json(): Promise<Json>`: Gets the payload as a JSON object
 - `request.data.text(): Promise<string>`: Gets the payload as a string
 - `request.data.buffer(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
-- `request.data.binary(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
-- `request.data.object<T>: Promise<T>`: Gets the payload as a typed object
+- `request.data.binary(): Promise<ArrayBuffer>`: Gets the payload as binary data
+- `request.data.object<T>(): Promise<T>`: Gets the payload as a typed object

Note: buffer() and binary() appear to have identical return types - verify if this is correct or if they serve different purposes.

📝 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
- `request.data.contentType`: Gets the content type of the request payload
- `request.data.json(): Promise<Json>`: Gets the payload as a JSON object
- `request.data.text(): Promise<string>`: Gets the payload as a string
- `request.data.buffer(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.binary(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.object<T>: Promise<T>`: Gets the payload as a typed object
- `request.data.contentType`: Gets the content type of the request payload
- `request.data.json(): Promise<Json>`: Gets the payload as a JSON object
- `request.data.text(): Promise<string>`: Gets the payload as a string
- `request.data.buffer(): Promise<ArrayBuffer>`: Gets the payload as a ArrayBuffer
- `request.data.binary(): Promise<ArrayBuffer>`: Gets the payload as binary data
- `request.data.object<T>(): Promise<T>`: Gets the payload as a typed object
🤖 Prompt for AI Agents
In frameworks/mastra/cat-fact-agent/.cursor/rules/sdk.mdc between lines 32 and
37, the method signatures for request.data are inconsistent, with some using
parentheses and others not, and buffer() and binary() having identical return
types. Standardize all method signatures to use parentheses for methods
returning promises, confirm if buffer() and binary() are distinct or redundant,
and update the documentation to reflect accurate method names and return types
consistently.

Comment on lines +66 to +68
- `context.kv.get(name, key)`: Retrieves a value
- `context.kv.set(name, key, value, params)`: Stores a value with optional params (KeyValueStorageSetParams)
- `context.kv.delete(name, key)`: Deletes a value
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

Add parameter type information for KV storage methods.

The key-value storage methods lack parameter type information, particularly for the params parameter.

-- `context.kv.set(name, key, value, params)`: Stores a value with optional params (KeyValueStorageSetParams)
+- `context.kv.get(name: string, key: string): Promise<any>`: Retrieves a value
+- `context.kv.set(name: string, key: string, value: any, params?: KeyValueStorageSetParams): Promise<void>`: Stores a value with optional params
+- `context.kv.delete(name: string, key: string): Promise<void>`: Deletes a value

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In frameworks/mastra/cat-fact-agent/.cursor/rules/sdk.mdc around lines 66 to 68,
the documentation for context.kv methods is missing parameter type details,
especially for the params argument in context.kv.set. Update the method
descriptions to include explicit parameter types, such as specifying that params
is of type KeyValueStorageSetParams, to improve clarity and usability of the SDK
documentation.

Comment on lines +74 to +76
- `context.vector.upsert(name, ...documents)`: Inserts or updates vectors
- `context.vector.search(name, params)`: Searches for vectors
- `context.vector.delete(name, ...ids)`: Deletes vectors
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

Add parameter type information for vector storage methods.

Similar to KV storage, vector storage methods need parameter type documentation.

-- `context.vector.upsert(name, ...documents)`: Inserts or updates vectors
-- `context.vector.search(name, params)`: Searches for vectors
-- `context.vector.delete(name, ...ids)`: Deletes vectors
+- `context.vector.upsert(name: string, ...documents: VectorDocument[]): Promise<void>`: Inserts or updates vectors
+- `context.vector.search(name: string, params: VectorSearchParams): Promise<VectorSearchResult[]>`: Searches for vectors
+- `context.vector.delete(name: string, ...ids: string[]): Promise<void>`: Deletes vectors
📝 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
- `context.vector.upsert(name, ...documents)`: Inserts or updates vectors
- `context.vector.search(name, params)`: Searches for vectors
- `context.vector.delete(name, ...ids)`: Deletes vectors
- `context.vector.upsert(name: string, ...documents: VectorDocument[]): Promise<void>`: Inserts or updates vectors
- `context.vector.search(name: string, params: VectorSearchParams): Promise<VectorSearchResult[]>`: Searches for vectors
- `context.vector.delete(name: string, ...ids: string[]): Promise<void>`: Deletes vectors
🤖 Prompt for AI Agents
In frameworks/mastra/cat-fact-agent/.cursor/rules/sdk.mdc around lines 74 to 76,
the vector storage methods lack parameter type documentation. Add detailed
parameter type information for the methods context.vector.upsert,
context.vector.search, and context.vector.delete, similar to how it is done for
KV storage methods, specifying the expected types for name, documents, params,
and ids to improve clarity and usability.

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.

2 participants