Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 35 additions & 8 deletions front_end/panels/ai_chat/agent_framework/AgentRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1575,14 +1575,41 @@ Key guidelines:
default:
summaryPrompt = `The agent "${agentName}" has reached its maximum iteration limit of ${maxIterations}.

Please analyze the entire conversation above and provide a concise summary that includes:

1. **User Request**: What the user originally asked for
2. **Agent Decisions**: Key decisions and actions the agent took
3. **Final State**: What the agent was doing when it timed out
4. **Progress Assessment**: Whether the agent was making progress or stuck

Format your response as a clear, informative summary that would help a calling agent understand what happened and decide next steps.`;
Please analyze the entire conversation above and provide a COMPREHENSIVE and DETAILED summary (minimum 400-600 words) that includes:

1. **User Request** (1-2 paragraphs)
- What the user originally asked for
- Key requirements and scope mentioned
- Expected deliverables or outcomes

2. **Agent Decisions** (2-3 paragraphs)
- List each tool call made with specific details (tool name, key arguments, purpose)
- Explain the reasoning behind each decision
- Describe the strategy or approach the agent took
- What data or information was extracted at each step
- Any patterns in the agent's behavior (e.g., broad searches, specific targeting)

3. **Final State** (1-2 paragraphs)
- Exactly what the agent was doing when it timed out
- What task was in progress
- What data had been gathered so far (URLs, content, structured data)
- State of any ongoing operations

4. **Progress Assessment** (2-3 paragraphs)
- Whether the agent was making meaningful progress toward the goal
- If stuck, identify loops, errors, or blocking issues
- Assess if the iteration limit (${maxIterations}) was appropriate for this task
- What percentage of the goal was accomplished
- Quality of work completed so far

5. **Recommendations for Next Steps** (2-3 paragraphs with bullet points)
- Specific, actionable steps a calling agent should take to continue this work
- Which tools to use next and with what arguments
- What data to prioritize or process
- Suggested iteration limit if re-running
- Alternative approaches if current path seems blocked

IMPORTANT: Even if the agent only completed a few iterations, provide DETAILED analysis of what it did accomplish. Describe each action comprehensively, analyze the decision-making, and provide concrete recommendations. Do not give brief answers - expand each section thoroughly with specific examples and data from the conversation.`;
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,5 +190,6 @@ ${args.input_data ? `Input Data: ${args.input_data}` : ''}
}
}
},
includeSummaryInAnswer: true, // Enable summary for action execution to provide insights
};
}
3 changes: 1 addition & 2 deletions front_end/panels/ai_chat/core/AgentNodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,7 @@ export function createToolExecutorNode(state: AgentState, provider: LLMProvider,
isError,
toolCallId, // Link back to the tool call for OpenAI format
...(isError && { error: resultText }),
// On errors, surface the tool result in the main chat lane so users see it
uiLane: (isAgentTool && !isError) ? 'agent' as const : 'chat',
uiLane: isAgentTool ? 'agent' as const : 'chat',
Comment on lines 1022 to +1025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restore chat lane for agent tool errors

The new uiLane assignment now routes every configurable agent tool result to the agent lane, even when isError is true. Previously, errors were intentionally surfaced to the main chat lane so the user could see failures (see the removed comment and the existing test case shows configurable agent tool error in chat when execution fails). With this change, tool failures triggered by an agent will be hidden alongside other agent-lane messages, breaking that UX and likely failing the test that asserts errors appear in the chat lane. Consider retaining the original conditional so that only successful agent tool results stay in the agent lane while errors remain visible in the chat lane.

Useful? React with 👍 / 👎.

};

logger.debug('ToolExecutorNode: Adding tool result message with toolCallId:', { toolCallId, toolResultMessage });
Expand Down