feat: add DedupHITLToolCallsMiddleware to prevent duplicate tool calls

- Introduced DedupHITLToolCallsMiddleware to prevent duplicate HITL tool calls within a single LLM response, ensuring only the first occurrence of each tool call is retained.
- Updated the create_surfsense_deep_agent function to include the new middleware, enhancing the efficiency of tool interactions.
- Added a new middleware file for better organization and maintainability of the codebase.
This commit is contained in:
Anish Sarkar 2026-03-21 03:47:30 +05:30
parent 744ad1fa79
commit ff6514a99f
13 changed files with 97 additions and 51 deletions

View file

@ -64,11 +64,6 @@ def create_delete_linear_issue_tool(
- If status is "not_found", inform the user conversationally using the exact message
provided. Do NOT treat this as an error. Simply relay the message and ask the user
to verify the issue title or identifier, or check if it has been indexed.
- ONLY call this tool ONCE per user request. The system automatically picks the
most relevant match when multiple issues share the same title. The user will
see the exact issue details in the approval card and can reject if it is not
the right one. Do NOT call this tool multiple times for the same issue reference.
Examples:
- "Delete the 'Fix login bug' Linear issue"
- "Archive ENG-42"

View file

@ -78,10 +78,6 @@ def create_update_linear_issue_tool(
- If status is "not_found", inform the user conversationally using the exact message
provided. Do NOT treat this as an error. Simply relay the message and ask the user
to verify the issue title or identifier, or check if it has been indexed.
- ONLY call this tool ONCE per user request. The system automatically picks the
most relevant match when multiple issues share the same title. The user will
see the exact issue details in the approval card and can reject if it is not
the right one. Do NOT call this tool multiple times for the same issue reference.
Examples:
- "Mark the 'Fix login bug' issue as done"