diff --git a/apps/rowboat/app/lib/client_utils.ts b/apps/rowboat/app/lib/client_utils.ts index eea2bffb..693a7fed 100644 --- a/apps/rowboat/app/lib/client_utils.ts +++ b/apps/rowboat/app/lib/client_utils.ts @@ -20,10 +20,13 @@ export function validateConfigChanges(configType: string, configChanges: Record< break; } case 'agent': { + // Determine if this is a pipeline agent from the config changes + const isPipelineAgent = configChanges.type === 'pipeline'; + testObject = { name: 'test', description: 'test', - type: 'conversation', + type: isPipelineAgent ? 'pipeline' : 'conversation', instructions: 'test', prompts: [], tools: [], @@ -31,8 +34,9 @@ export function validateConfigChanges(configType: string, configChanges: Record< ragReturnType: 'chunks', ragK: 10, connectedAgents: [], - controlType: 'retain', - outputVisibility: 'user_facing', + // Set correct defaults based on agent type + controlType: isPipelineAgent ? 'relinquish_to_parent' : 'retain', + outputVisibility: isPipelineAgent ? 'internal' : 'user_facing', maxCallsPerParentAgent: 3, } as z.infer; schema = WorkflowAgent; diff --git a/apps/rowboat/app/lib/copilot/copilot.ts b/apps/rowboat/app/lib/copilot/copilot.ts index 2112d9cb..eb26bd3c 100644 --- a/apps/rowboat/app/lib/copilot/copilot.ts +++ b/apps/rowboat/app/lib/copilot/copilot.ts @@ -136,13 +136,38 @@ async function searchRelevantTools(query: string): Promise { return ''; } - const toolSlugs: string[] = searchResult.data.results.map((result: any) => result.tool); + // Log the actual response structure to debug + logger.log("Raw search results:", JSON.stringify(searchResult.data.results, null, 2)); + + // Extract tool slugs with defensive handling for different possible field names + const toolSlugs: string[] = searchResult.data.results + .map((result: any) => { + // Try different possible field names for the tool slug + const slug = result.tool || result.slug || result.tool_slug || result.name; + logger.log(`Processing result:`, { result, extractedSlug: slug }); + return slug; + }) + .filter((slug): slug is string => { + const isValid = typeof slug === 'string' && slug.length > 0; + if (!isValid) { + logger.log(`Filtering out invalid slug:`, slug); + } + return isValid; + }); + logger.log(`found tool slugs: ${toolSlugs.join(', ')}`); console.log("✅ TOOL CALL SUCCESS: COMPOSIO_SEARCH_TOOLS", { toolSlugs, resultCount: toolSlugs.length }); + // Check if we have any valid tool slugs before proceeding + if (toolSlugs.length === 0) { + logger.log("No valid tool slugs found after filtering"); + console.log("⚠️ TOOL CALL WARNING: No valid tools found after filtering"); + return 'No valid tools found for the given query. The search returned results but they contained invalid tool identifiers.'; + } + // Enrich tools with full details console.log("🔧 TOOL CALL: getTool (multiple calls)", { toolSlugs }); const composioTools = await Promise.all(toolSlugs.map(slug => getTool(slug)));