Skip to content

Commit 8b5e408

Browse files
authored
Fix the agent runner bug (#67)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Release Notes * **New Features** * Agent summaries now provide comprehensive, multi-section analysis with detailed breakdowns of decisions, actions, and recommendations. * Action agent automatically includes structured summaries in responses for improved transparency. * Agent tool results now consistently display in the agent conversation lane, enhancing message organization and readability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent ebd0883 commit 8b5e408

File tree

3 files changed

+37
-10
lines changed

3 files changed

+37
-10
lines changed

front_end/panels/ai_chat/agent_framework/AgentRunner.ts

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,14 +1575,41 @@ Key guidelines:
15751575
default:
15761576
summaryPrompt = `The agent "${agentName}" has reached its maximum iteration limit of ${maxIterations}.
15771577
1578-
Please analyze the entire conversation above and provide a concise summary that includes:
1579-
1580-
1. **User Request**: What the user originally asked for
1581-
2. **Agent Decisions**: Key decisions and actions the agent took
1582-
3. **Final State**: What the agent was doing when it timed out
1583-
4. **Progress Assessment**: Whether the agent was making progress or stuck
1584-
1585-
Format your response as a clear, informative summary that would help a calling agent understand what happened and decide next steps.`;
1578+
Please analyze the entire conversation above and provide a COMPREHENSIVE and DETAILED summary (minimum 400-600 words) that includes:
1579+
1580+
1. **User Request** (1-2 paragraphs)
1581+
- What the user originally asked for
1582+
- Key requirements and scope mentioned
1583+
- Expected deliverables or outcomes
1584+
1585+
2. **Agent Decisions** (2-3 paragraphs)
1586+
- List each tool call made with specific details (tool name, key arguments, purpose)
1587+
- Explain the reasoning behind each decision
1588+
- Describe the strategy or approach the agent took
1589+
- What data or information was extracted at each step
1590+
- Any patterns in the agent's behavior (e.g., broad searches, specific targeting)
1591+
1592+
3. **Final State** (1-2 paragraphs)
1593+
- Exactly what the agent was doing when it timed out
1594+
- What task was in progress
1595+
- What data had been gathered so far (URLs, content, structured data)
1596+
- State of any ongoing operations
1597+
1598+
4. **Progress Assessment** (2-3 paragraphs)
1599+
- Whether the agent was making meaningful progress toward the goal
1600+
- If stuck, identify loops, errors, or blocking issues
1601+
- Assess if the iteration limit (${maxIterations}) was appropriate for this task
1602+
- What percentage of the goal was accomplished
1603+
- Quality of work completed so far
1604+
1605+
5. **Recommendations for Next Steps** (2-3 paragraphs with bullet points)
1606+
- Specific, actionable steps a calling agent should take to continue this work
1607+
- Which tools to use next and with what arguments
1608+
- What data to prioritize or process
1609+
- Suggested iteration limit if re-running
1610+
- Alternative approaches if current path seems blocked
1611+
1612+
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.`;
15861613
break;
15871614
}
15881615

front_end/panels/ai_chat/agent_framework/implementation/agents/ActionAgent.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,5 +190,6 @@ ${args.input_data ? `Input Data: ${args.input_data}` : ''}
190190
}
191191
}
192192
},
193+
includeSummaryInAnswer: true, // Enable summary for action execution to provide insights
193194
};
194195
}

front_end/panels/ai_chat/core/AgentNodes.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,7 @@ export function createToolExecutorNode(state: AgentState, provider: LLMProvider,
10221022
isError,
10231023
toolCallId, // Link back to the tool call for OpenAI format
10241024
...(isError && { error: resultText }),
1025-
// On errors, surface the tool result in the main chat lane so users see it
1026-
uiLane: (isAgentTool && !isError) ? 'agent' as const : 'chat',
1025+
uiLane: isAgentTool ? 'agent' as const : 'chat',
10271026
};
10281027

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

0 commit comments

Comments
 (0)