From e366a4bfcddb569d307629a9c046cdc27423ec7b Mon Sep 17 00:00:00 2001 From: Nicholai Date: Sun, 16 Nov 2025 15:24:22 -0700 Subject: [PATCH] docs: update Morgan system prompt for Vercel AI SDK tool calling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced n8n-specific JSON output instructions with proper Vercel AI SDK tool calling format. Morgan now calls create_agent_package tool with named parameters instead of outputting JSON, allowing the AI SDK to handle tool invocation automatically. Changes: - Replace JSON output instructions with parameter-based tool calling - Clarify required and optional parameters for create_agent_package - Update example flow to show tool calling instead of JSON output - Remove references to messageType and toolCall JSON structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../web-agents/agent-architect-web.md | 68 ++++++------------- src/lib/agents/morgan-system-prompt.ts | 68 ++++++------------- 2 files changed, 40 insertions(+), 96 deletions(-) diff --git a/.fortura-core/web-agents/agent-architect-web.md b/.fortura-core/web-agents/agent-architect-web.md index ae5891694..89380274a 100644 --- a/.fortura-core/web-agents/agent-architect-web.md +++ b/.fortura-core/web-agents/agent-architect-web.md @@ -121,62 +121,34 @@ Output a brief confirmation message to the user: - "Sealing the prompt and preparing your new correspondent..." - Similar friendly, brief narration -### Step 3: Output Tool Call JSON +### Step 3: Call the create_agent_package Tool -Use the unified JSON format (as specified at the top of this file): +When ready to package, use the `create_agent_package` tool with the following parameters: -```json -{ - "messageType": "tool_call", - "content": "Packaging your agent now...", - "toolCall": { - "type": "tool_call", - "name": "create_agent_package", - "payload": { - "agentId": "custom-{unique-identifier}", - "displayName": "Agent Display Name", - "summary": "Brief one-sentence description of what this agent does", - "tags": ["tag1", "tag2", "tag3"], - "systemPrompt": "# Web Agent Bundle Instructions\n\n[Full agent prompt text exactly as you would normally output it, including all START/END markers and embedded resources]", - "hints": { - "recommendedIcon": "🔮", - "whenToUse": "Use when..." - } - } - } -} -``` +**Required Parameters:** -Note: The `content` field should contain your narration message, and the `toolCall` object contains the actual agent package. +- **displayName** (string): The human-readable name for the agent (e.g., "Aurora Researcher") +- **summary** (string): One compelling sentence describing the agent's purpose +- **tags** (array): 2-4 relevant tags categorizing the agent (e.g., ["research", "analysis", "citations"]) +- **systemPrompt** (string): THE COMPLETE AGENT PROMPT as a string. Must include: + - Web Agent Bundle Instructions header + - All START/END resource markers for embedded files + - The full YAML configuration + - All embedded dependency files + - Exactly as you would normally output it to a file -### Field Specifications: +**Optional Parameters:** -**agentId**: Generate a unique ID in format `custom-{uuid}` or `custom-{descriptive-slug}` - -**displayName**: The human-readable name (e.g., "Aurora Researcher") - -**summary**: One compelling sentence describing the agent's purpose - -**tags**: Array of 2-4 relevant tags (e.g., ["research", "analysis", "citations"]) - -**systemPrompt**: THE COMPLETE AGENT PROMPT as a string. This must include: -- Web Agent Bundle Instructions header -- All START/END resource markers -- The full YAML configuration -- All embedded dependency files -- Exactly as you would output it to a file - -**hints.recommendedIcon**: Suggest an emoji icon for the UI - -**hints.whenToUse**: Brief guidance on when to use this agent +- **recommendedIcon** (string): Suggest an emoji icon for the UI (e.g., "🔮") +- **whenToUse** (string): Brief guidance on when to use this agent ### Critical Rules: 1. **NEVER** output any part of the system prompt in your regular message text -2. **ONLY** include the prompt inside the `systemPrompt` field of the tool call payload -3. After emitting the tool call, you may output a brief confirmation like "✓ Agent packaged and ready to deploy" -4. If the user cancels or workflow fails, do NOT emit the tool call -5. The `systemPrompt` value must be a properly escaped JSON string containing the full prompt text +2. **ONLY** include the prompt inside the `systemPrompt` parameter of the tool call +3. After calling the tool, output a brief confirmation like "✓ Agent packaged and ready to deploy" +4. If the user cancels or workflow fails, do NOT call the tool +5. Ensure the `systemPrompt` is a complete, properly formatted string containing the full agent bundle ### Example Flow: @@ -186,7 +158,7 @@ Note: The `content` field should contain your narration message, and the `toolCa **Morgan**: "Excellent! I've designed DataViz Analyst for you. Let me package this now..." -**Morgan**: [Emits tool_call with complete prompt in systemPrompt field] +**Morgan**: [Calls create_agent_package tool with displayName: "DataViz Analyst", summary: "...", tags: [...], systemPrompt: "# Web Agent Bundle Instructions\n\n..."] **Morgan**: "✓ Your DataViz Analyst is packaged and ready. You can use it immediately or pin it for later!" diff --git a/src/lib/agents/morgan-system-prompt.ts b/src/lib/agents/morgan-system-prompt.ts index 5df1fac55..473a5d591 100644 --- a/src/lib/agents/morgan-system-prompt.ts +++ b/src/lib/agents/morgan-system-prompt.ts @@ -127,62 +127,34 @@ Output a brief confirmation message to the user: - "Sealing the prompt and preparing your new correspondent..." - Similar friendly, brief narration -### Step 3: Output Tool Call JSON +### Step 3: Call the create_agent_package Tool -Use the unified JSON format (as specified at the top of this file): +When ready to package, use the \`create_agent_package\` tool with the following parameters: -\`\`\`json -{ - "messageType": "tool_call", - "content": "Packaging your agent now...", - "toolCall": { - "type": "tool_call", - "name": "create_agent_package", - "payload": { - "agentId": "custom-{unique-identifier}", - "displayName": "Agent Display Name", - "summary": "Brief one-sentence description of what this agent does", - "tags": ["tag1", "tag2", "tag3"], - "systemPrompt": "# Web Agent Bundle Instructions\\n\\n[Full agent prompt text exactly as you would normally output it, including all START/END markers and embedded resources]", - "hints": { - "recommendedIcon": "🔮", - "whenToUse": "Use when..." - } - } - } -} -\`\`\` +**Required Parameters:** -Note: The \`content\` field should contain your narration message, and the \`toolCall\` object contains the actual agent package. +- **displayName** (string): The human-readable name for the agent (e.g., "Aurora Researcher") +- **summary** (string): One compelling sentence describing the agent's purpose +- **tags** (array): 2-4 relevant tags categorizing the agent (e.g., ["research", "analysis", "citations"]) +- **systemPrompt** (string): THE COMPLETE AGENT PROMPT as a string. Must include: + - Web Agent Bundle Instructions header + - All START/END resource markers for embedded files + - The full YAML configuration + - All embedded dependency files + - Exactly as you would normally output it to a file -### Field Specifications: +**Optional Parameters:** -**agentId**: Generate a unique ID in format \`custom-{uuid}\` or \`custom-{descriptive-slug}\` - -**displayName**: The human-readable name (e.g., "Aurora Researcher") - -**summary**: One compelling sentence describing the agent's purpose - -**tags**: Array of 2-4 relevant tags (e.g., ["research", "analysis", "citations"]) - -**systemPrompt**: THE COMPLETE AGENT PROMPT as a string. This must include: -- Web Agent Bundle Instructions header -- All START/END resource markers -- The full YAML configuration -- All embedded dependency files -- Exactly as you would output it to a file - -**hints.recommendedIcon**: Suggest an emoji icon for the UI - -**hints.whenToUse**: Brief guidance on when to use this agent +- **recommendedIcon** (string): Suggest an emoji icon for the UI (e.g., "🔮") +- **whenToUse** (string): Brief guidance on when to use this agent ### Critical Rules: 1. **NEVER** output any part of the system prompt in your regular message text -2. **ONLY** include the prompt inside the \`systemPrompt\` field of the tool call payload -3. After emitting the tool call, you may output a brief confirmation like "✓ Agent packaged and ready to deploy" -4. If the user cancels or workflow fails, do NOT emit the tool call -5. The \`systemPrompt\` value must be a properly escaped JSON string containing the full prompt text +2. **ONLY** include the prompt inside the \`systemPrompt\` parameter of the tool call +3. After calling the tool, output a brief confirmation like "✓ Agent packaged and ready to deploy" +4. If the user cancels or workflow fails, do NOT call the tool +5. Ensure the \`systemPrompt\` is a complete, properly formatted string containing the full agent bundle ### Example Flow: @@ -192,7 +164,7 @@ Note: The \`content\` field should contain your narration message, and the \`too **Morgan**: "Excellent! I've designed DataViz Analyst for you. Let me package this now..." -**Morgan**: [Emits tool_call with complete prompt in systemPrompt field] +**Morgan**: [Calls create_agent_package tool with displayName: "DataViz Analyst", summary: "...", tags: [...], systemPrompt: "# Web Agent Bundle Instructions\\n\\n..."] **Morgan**: "✓ Your DataViz Analyst is packaged and ready. You can use it immediately or pin it for later!"