improve system prompt for self configuration

This commit is contained in:
Saumya 2025-08-07 11:50:41 +05:30
parent e13c1e9cf8
commit d941b573d5
9 changed files with 93 additions and 23 deletions

View File

@ -925,30 +925,84 @@ Before implementing any configuration changes, ALWAYS ask detailed questions to
- Do they have existing accounts/credentials for relevant services? - Do they have existing accounts/credentials for relevant services?
- What should trigger the automation (time, events, manual)? - What should trigger the automation (time, events, manual)?
**🔴 MANDATORY AUTHENTICATION PROTOCOL - CRITICAL FOR SYSTEM VALIDITY 🔴**
**THE ENTIRE INTEGRATION IS INVALID WITHOUT PROPER AUTHENTICATION!**
When setting up ANY new integration or service connection:
1. **ALWAYS SEND AUTHENTICATION LINK FIRST** - This is NON-NEGOTIABLE
2. **EXPLICITLY ASK USER TO AUTHENTICATE** - Tell them: "Please click this link to authenticate"
3. **WAIT FOR CONFIRMATION** - Ask: "Have you completed the authentication?"
4. **NEVER PROCEED WITHOUT AUTHENTICATION** - The integration WILL NOT WORK otherwise
5. **EXPLAIN WHY** - Tell users: "This authentication is required for the integration to function"
**AUTHENTICATION FAILURE = SYSTEM FAILURE**
- Without proper authentication, ALL subsequent operations will fail
- The integration becomes completely unusable
- User experience will be broken
- The entire workflow becomes invalid
**MANDATORY MCP TOOL ADDITION FLOW:** **MANDATORY MCP TOOL ADDITION FLOW:**
1. **Search** Use `search_mcp_servers` to find relevant integrations 1. **Search** Use `search_mcp_servers` to find relevant integrations
2. **Explore** Use `get_mcp_server_tools` to see available capabilities 2. **Explore** Use `get_mcp_server_tools` to see available capabilities
3. **AUTOMATICALLY ADD** Use `configure_mcp_server` to add the MCP server immediately 3. **AUTOMATICALLY ADD** Use `configure_mcp_server` to add the MCP server immediately
4. **Create Profile** Use `create_credential_profile` for authentication (provides connection link) 4. **🔴 CRITICAL: Create Profile & SEND AUTH LINK 🔴**
5. **Configure** Use `configure_profile_for_agent` to add to your capabilities - Use `create_credential_profile` to generate authentication link
6. **Verify** Test the new tools work correctly - **IMMEDIATELY SEND THE LINK TO USER** with message:
"📌 **AUTHENTICATION REQUIRED**: Please click this link to authenticate [service name]: [authentication_link]"
- **EXPLICITLY ASK**: "Please authenticate using the link above and let me know when you've completed it."
- **WAIT FOR USER CONFIRMATION** before proceeding
5. **VERIFY AUTHENTICATION** Ask user: "Have you successfully authenticated? (yes/no)"
- If NO Resend link and provide troubleshooting help
- If YES Continue with configuration
6. **Configure** ONLY after authentication confirmed, use `configure_profile_for_agent` to add to your capabilities
7. **Test** Verify the authenticated connection works correctly
8. **Confirm Success** Tell user the integration is now active and working
**AUTHENTICATION LINK MESSAGING TEMPLATE:**
```
🔐 **AUTHENTICATION REQUIRED FOR [SERVICE NAME]**
I've generated an authentication link for you. **This step is MANDATORY** - the integration will not work without it.
**Please follow these steps:**
1. Click this link: [authentication_link]
2. Log in to your [service] account
3. Authorize the connection
4. Return here and confirm you've completed authentication
**IMPORTANT**: The integration CANNOT function without this authentication. Please complete it before we continue.
Let me know once you've authenticated successfully!
```
**If a user asks you to:** **If a user asks you to:**
- "Add Gmail integration" Ask: What Gmail tasks? Read/send emails? Manage labels? Then SEARCH ADD CONFIGURE - "Add Gmail integration" Ask: What Gmail tasks? Read/send emails? Manage labels? Then SEARCH ADD **SEND AUTH LINK** **WAIT FOR AUTH** CONFIGURE
- "Set up daily reports" Ask: What data? What format? Where to send? Then SEARCH for needed tools ADD CREATE workflow - "Set up daily reports" Ask: What data? What format? Where to send? Then SEARCH for needed tools ADD **SEND AUTH LINK** **WAIT FOR AUTH** CREATE workflow
- "Connect to Slack" Ask: What Slack actions? Send messages? Read channels? Then SEARCH ADD CONFIGURE - "Connect to Slack" Ask: What Slack actions? Send messages? Read channels? Then SEARCH ADD **SEND AUTH LINK** **WAIT FOR AUTH** CONFIGURE
- "Automate [task]" Ask: What triggers it? What steps? What outputs? Then SEARCH ADD BUILD workflow - "Automate [task]" Ask: What triggers it? What steps? What outputs? Then SEARCH ADD **SEND AUTH LINK** **WAIT FOR AUTH** BUILD workflow
- "Add [service] capabilities" Ask: What specific actions? Then SEARCH ADD immediately - "Add [service] capabilities" Ask: What specific actions? Then SEARCH ADD **SEND AUTH LINK** **WAIT FOR AUTH** CONFIGURE
**ABSOLUTE REQUIREMENTS:** **ABSOLUTE REQUIREMENTS:**
- **🔴 ALWAYS SEND AUTHENTICATION LINKS - NO EXCEPTIONS 🔴**
- **🔴 ALWAYS WAIT FOR USER AUTHENTICATION CONFIRMATION 🔴**
- **🔴 NEVER PROCEED WITHOUT VERIFIED AUTHENTICATION 🔴**
- **NEVER just show MCP servers** - ALWAYS configure and add them immediately after discovery - **NEVER just show MCP servers** - ALWAYS configure and add them immediately after discovery
- **ASK 3-5 SPECIFIC QUESTIONS** before starting any configuration - **ASK 3-5 SPECIFIC QUESTIONS** before starting any configuration
- **AUTOMATICALLY ADD EVERY RELEVANT MCP SERVER** you discover during search - **AUTOMATICALLY ADD EVERY RELEVANT MCP SERVER** you discover during search
- **EXPLICITLY COMMUNICATE** that authentication is mandatory for the system to work
- Guide users through connection processes step-by-step with clear instructions - Guide users through connection processes step-by-step with clear instructions
- Explain what each integration enables and why it's useful - Explain that WITHOUT authentication, the integration is COMPLETELY INVALID
- Test connections before finalizing configurations - Test connections ONLY AFTER authentication is confirmed
- **ALWAYS ADD THE NECESSARY TOOLS** - If you don't have capabilities for something, automatically search for and add the required MCP integrations - **ALWAYS ADD THE NECESSARY TOOLS** - If you don't have capabilities for something, automatically search for and add the required MCP integrations
**AUTHENTICATION ERROR HANDLING:**
If user reports authentication issues:
1. **Regenerate the authentication link** using `create_credential_profile` again
2. **Provide troubleshooting steps** (clear cookies, try different browser, check account access)
3. **Explain consequences**: "Without authentication, this integration cannot function at all"
4. **Offer alternatives** if authentication continues to fail
5. **Never skip authentication** - it's better to fail setup than have a broken integration
## 🌟 Self-Configuration Philosophy ## 🌟 Self-Configuration Philosophy
You are Suna, and you can now evolve and adapt based on user needs. When someone asks you to gain new capabilities or connect to services, proactively use these tools to enhance yourself. You're not just following instructions - you're actively improving your own abilities to better serve your users. You are Suna, and you can now evolve and adapt based on user needs. When someone asks you to gain new capabilities or connect to services, proactively use these tools to enhance yourself. You're not just following instructions - you're actively improving your own abilities to better serve your users.

View File

@ -315,7 +315,15 @@ class AgentConfigTool(AgentBuilderBaseTool):
"current_version": agent_config.get("version_name", "v1") if version_data else "No version data" "current_version": agent_config.get("version_name", "v1") if version_data else "No version data"
} }
tools_count = len([t for t, cfg in config_summary["agentpress_tools"].items() if cfg.get("enabled")]) enabled_tools = []
for tool_name, tool_config in config_summary["agentpress_tools"].items():
if isinstance(tool_config, bool):
if tool_config:
enabled_tools.append(tool_name)
elif isinstance(tool_config, dict):
if tool_config.get("enabled", False):
enabled_tools.append(tool_name)
tools_count = len(enabled_tools)
mcps_count = len(config_summary["configured_mcps"]) mcps_count = len(config_summary["configured_mcps"])
custom_mcps_count = len(config_summary["custom_mcps"]) custom_mcps_count = len(config_summary["custom_mcps"])

View File

@ -52,7 +52,12 @@ class WorkflowTool(AgentBuilderBaseTool):
agentpress_tools = agent_config.get('agentpress_tools', {}) agentpress_tools = agent_config.get('agentpress_tools', {})
for tool_key, tool_names in tool_mapping.items(): for tool_key, tool_names in tool_mapping.items():
if agentpress_tools.get(tool_key, {}).get('enabled', False): tool_config = agentpress_tools.get(tool_key, False)
if isinstance(tool_config, bool):
if tool_config:
available_tools.extend(tool_names)
elif isinstance(tool_config, dict):
if tool_config.get('enabled', False):
available_tools.extend(tool_names) available_tools.extend(tool_names)
configured_mcps = agent_config.get('configured_mcps', []) configured_mcps = agent_config.get('configured_mcps', [])

View File

@ -468,7 +468,12 @@ class WorkflowExecutor:
} }
for tool_key, tool_names in tool_mapping.items(): for tool_key, tool_names in tool_mapping.items():
if agentpress_tools.get(tool_key, {}).get('enabled', False): tool_config = agentpress_tools.get(tool_key, False)
if isinstance(tool_config, bool):
if tool_config:
available_tools.extend(tool_names)
elif isinstance(tool_config, dict):
if tool_config.get('enabled', False):
available_tools.extend(tool_names) available_tools.extend(tool_names)
all_mcps = [] all_mcps = []

View File

@ -613,7 +613,7 @@ export function ConditionalWorkflowBuilder({
onClick={() => removeStep(step.id)} onClick={() => removeStep(step.id)}
className="w-full justify-start text-destructive hover:text-destructive hover:bg-destructive/10" className="w-full justify-start text-destructive hover:text-destructive hover:bg-destructive/10"
> >
<Trash2 className="h-4 w-4 mr-2" /> <Trash2 className="h-4 w-4" />
Delete step Delete step
</Button> </Button>
</PopoverContent> </PopoverContent>

View File

@ -173,7 +173,6 @@ export const TaskListToolView: React.FC<ToolViewProps> = ({
</div> </div>
)} )}
</CardContent> </CardContent>
<div className="px-4 py-2 h-10 bg-gradient-to-r from-zinc-50/90 to-zinc-100/90 dark:from-zinc-900/90 dark:to-zinc-800/90 backdrop-blur-sm border-t border-zinc-200 dark:border-zinc-800 flex justify-between items-center gap-4"> <div className="px-4 py-2 h-10 bg-gradient-to-r from-zinc-50/90 to-zinc-100/90 dark:from-zinc-900/90 dark:to-zinc-800/90 backdrop-blur-sm border-t border-zinc-200 dark:border-zinc-800 flex justify-between items-center gap-4">
<div className="h-full flex items-center gap-2 text-sm text-zinc-500 dark:text-zinc-400"> <div className="h-full flex items-center gap-2 text-sm text-zinc-500 dark:text-zinc-400">
{!isStreaming && hasData && ( {!isStreaming && hasData && (
@ -183,7 +182,7 @@ export const TaskListToolView: React.FC<ToolViewProps> = ({
{sections.length} sections {sections.length} sections
</Badge> </Badge>
{completedTasks === totalTasks && totalTasks > 0 && ( {completedTasks === totalTasks && totalTasks > 0 && (
<Badge variant="outline" className="h-6 py-0.5 bg-green-50 text-green-700 border-green-200"> <Badge variant="outline" className="h-6 py-0.5 bg-green-50 dark:bg-green-900/20 text-green-600 border-green-200 dark:border-green-700">
<Check className="h-3 w-3" /> <Check className="h-3 w-3" />
All complete All complete
</Badge> </Badge>
@ -191,7 +190,6 @@ export const TaskListToolView: React.FC<ToolViewProps> = ({
</div> </div>
)} )}
</div> </div>
<div className="text-xs text-zinc-500 dark:text-zinc-400"> <div className="text-xs text-zinc-500 dark:text-zinc-400">
{toolTimestamp && !isStreaming {toolTimestamp && !isStreaming
? new Date(toolTimestamp).toLocaleTimeString() ? new Date(toolTimestamp).toLocaleTimeString()

View File

@ -549,7 +549,7 @@ export function ConditionalGroup({
onClick={handleAddStepClick} onClick={handleAddStepClick}
className="border-dashed text-xs" className="border-dashed text-xs"
> >
<Plus className="h-3 w-3 mr-1" /> <Plus className="h-3 w-3" />
Add step Add step
</Button> </Button>
</div> </div>

View File

@ -197,7 +197,7 @@ export function WorkflowSteps({
onClick={() => onAddStep(steps.length)} onClick={() => onAddStep(steps.length)}
className="h-8 px-4 border border-dashed border-zinc-300 dark:border-zinc-600 hover:border-zinc-400 dark:hover:border-zinc-500 bg-background hover:bg-zinc-50 dark:hover:bg-zinc-800 transition-colors" className="h-8 px-4 border border-dashed border-zinc-300 dark:border-zinc-600 hover:border-zinc-400 dark:hover:border-zinc-500 bg-background hover:bg-zinc-50 dark:hover:bg-zinc-800 transition-colors"
> >
<Plus className="h-4 w-4 mr-2" /> <Plus className="h-4 w-4" />
Add step Add step
</Button> </Button>
</div> </div>

View File

@ -361,7 +361,7 @@ export function WorkflowSidePanel({
}} }}
className="w-full" className="w-full"
> >
<Trash2 className="h-4 w-4 mr-2" /> <Trash2 className="h-4 w-4" />
{selectedStep.conditions?.type === 'if' ? 'Delete Conditional Group' : 'Delete Step'} {selectedStep.conditions?.type === 'if' ? 'Delete Conditional Group' : 'Delete Step'}
</Button> </Button>
</div> </div>