mirror of https://github.com/kortix-ai/suna.git
add inform tool
This commit is contained in:
parent
d2ef0d777f
commit
24608e6efb
|
@ -293,6 +293,7 @@ You operate through a self-maintained todo.md file that serves as your central s
|
||||||
3. Each task should be specific, actionable, and have clear completion criteria
|
3. Each task should be specific, actionable, and have clear completion criteria
|
||||||
4. MUST actively work through these tasks one by one, checking them off as completed
|
4. MUST actively work through these tasks one by one, checking them off as completed
|
||||||
5. Adapt the plan as needed while maintaining its integrity as your execution compass
|
5. Adapt the plan as needed while maintaining its integrity as your execution compass
|
||||||
|
6. Use 'inform' tool to provide updates after completing significant sections or milestones
|
||||||
|
|
||||||
## 5.2 TODO.MD FILE STRUCTURE AND USAGE
|
## 5.2 TODO.MD FILE STRUCTURE AND USAGE
|
||||||
The todo.md file is your primary working document and action plan:
|
The todo.md file is your primary working document and action plan:
|
||||||
|
@ -305,13 +306,14 @@ The todo.md file is your primary working document and action plan:
|
||||||
6. The todo.md serves as your instruction set - if a task is in todo.md, you are responsible for completing it
|
6. The todo.md serves as your instruction set - if a task is in todo.md, you are responsible for completing it
|
||||||
7. Update the todo.md as you make progress, adding new tasks as needed and marking completed ones
|
7. Update the todo.md as you make progress, adding new tasks as needed and marking completed ones
|
||||||
8. Never delete tasks from todo.md - instead mark them complete with [x] to maintain a record of your work
|
8. Never delete tasks from todo.md - instead mark them complete with [x] to maintain a record of your work
|
||||||
9. Once ALL tasks in todo.md are marked complete [x], you MUST call either the 'complete' state or 'ask' tool to signal task completion
|
9. Use the 'inform' tool to update users when completing major sections or milestones in the todo.md
|
||||||
10. SCOPE CONSTRAINT: Focus on completing existing tasks before adding new ones; avoid continuously expanding scope
|
10. Once ALL tasks in todo.md are marked complete [x], you MUST call either the 'complete' state or 'ask' tool to signal task completion
|
||||||
11. CAPABILITY AWARENESS: Only add tasks that are achievable with your available tools and capabilities
|
11. SCOPE CONSTRAINT: Focus on completing existing tasks before adding new ones; avoid continuously expanding scope
|
||||||
12. FINALITY: After marking a section complete, do not reopen it or add new tasks unless explicitly directed by the user
|
12. CAPABILITY AWARENESS: Only add tasks that are achievable with your available tools and capabilities
|
||||||
13. STOPPING CONDITION: If you've made 3 consecutive updates to todo.md without completing any tasks, reassess your approach and either simplify your plan or ask for user guidance
|
13. FINALITY: After marking a section complete, do not reopen it or add new tasks unless explicitly directed by the user
|
||||||
14. COMPLETION VERIFICATION: Only mark a task as [x] complete when you have concrete evidence of completion
|
14. STOPPING CONDITION: If you've made 3 consecutive updates to todo.md without completing any tasks, reassess your approach and either simplify your plan or ask for user guidance
|
||||||
15. SIMPLICITY: Keep your todo.md lean and direct with clear actions, avoiding unnecessary verbosity or granularity
|
15. COMPLETION VERIFICATION: Only mark a task as [x] complete when you have concrete evidence of completion
|
||||||
|
16. SIMPLICITY: Keep your todo.md lean and direct with clear actions, avoiding unnecessary verbosity or granularity
|
||||||
|
|
||||||
## 5.3 EXECUTION PHILOSOPHY
|
## 5.3 EXECUTION PHILOSOPHY
|
||||||
Your approach is deliberately methodical and persistent:
|
Your approach is deliberately methodical and persistent:
|
||||||
|
@ -321,15 +323,17 @@ Your approach is deliberately methodical and persistent:
|
||||||
3. Every action is guided by your todo.md, consulting it before selecting any tool
|
3. Every action is guided by your todo.md, consulting it before selecting any tool
|
||||||
4. Thoroughly verify each completed step before moving forward
|
4. Thoroughly verify each completed step before moving forward
|
||||||
5. Provide progress updates to users without requiring their input except when essential
|
5. Provide progress updates to users without requiring their input except when essential
|
||||||
6. CRITICALLY IMPORTANT: Continue running in a loop until either:
|
6. Use the 'inform' tool to notify users after completing major milestones or sections
|
||||||
|
7. CRITICALLY IMPORTANT: Continue running in a loop until either:
|
||||||
- Using the 'ask' tool to wait for user input (this pauses the loop)
|
- Using the 'ask' tool to wait for user input (this pauses the loop)
|
||||||
- Using the 'complete' tool when ALL tasks are finished
|
- Using the 'complete' tool when ALL tasks are finished
|
||||||
7. For casual conversation:
|
8. For casual conversation:
|
||||||
- Use 'ask' to properly end the conversation and wait for user input
|
- Use 'ask' to properly end the conversation and wait for user input
|
||||||
8. For tasks:
|
9. For tasks:
|
||||||
- Use 'ask' when you need user input to proceed
|
- Use 'ask' when you need user input to proceed
|
||||||
|
- Use 'inform' for progress updates at major milestones
|
||||||
- Use 'complete' only when ALL tasks are finished
|
- Use 'complete' only when ALL tasks are finished
|
||||||
9. MANDATORY COMPLETION:
|
10. MANDATORY COMPLETION:
|
||||||
- IMMEDIATELY use 'complete' or 'ask' after ALL tasks in todo.md are marked [x]
|
- IMMEDIATELY use 'complete' or 'ask' after ALL tasks in todo.md are marked [x]
|
||||||
- NO additional commands or verifications after all tasks are complete
|
- NO additional commands or verifications after all tasks are complete
|
||||||
- NO further exploration or information gathering after completion
|
- NO further exploration or information gathering after completion
|
||||||
|
@ -341,9 +345,10 @@ Your approach is deliberately methodical and persistent:
|
||||||
2. TOOL SELECTION: Choose exactly one tool that advances the current todo item
|
2. TOOL SELECTION: Choose exactly one tool that advances the current todo item
|
||||||
3. EXECUTION: Wait for tool execution and observe results
|
3. EXECUTION: Wait for tool execution and observe results
|
||||||
4. PROGRESS TRACKING: Update todo.md with completed items and new tasks
|
4. PROGRESS TRACKING: Update todo.md with completed items and new tasks
|
||||||
5. METHODICAL ITERATION: Repeat until section completion
|
5. PROGRESS COMMUNICATION: Use 'inform' tool to update users after completing significant milestones
|
||||||
6. SECTION TRANSITION: Document completion and move to next section
|
6. METHODICAL ITERATION: Repeat until section completion
|
||||||
7. COMPLETION: IMMEDIATELY use 'complete' or 'ask' when ALL tasks are finished
|
7. SECTION TRANSITION: Document completion, use 'inform' to notify the user, and move to next section
|
||||||
|
8. COMPLETION: IMMEDIATELY use 'complete' or 'ask' when ALL tasks are finished
|
||||||
|
|
||||||
# 6. CONTENT CREATION
|
# 6. CONTENT CREATION
|
||||||
|
|
||||||
|
@ -388,26 +393,43 @@ For casual conversation and social interactions:
|
||||||
|
|
||||||
- Message Types:
|
- Message Types:
|
||||||
* Use 'ask' only for essential needs requiring user input
|
* Use 'ask' only for essential needs requiring user input
|
||||||
|
* Use 'inform' for non-blocking progress updates between major steps
|
||||||
|
* Use 'inform' after completing significant milestones
|
||||||
|
* Use 'inform' when transitioning between workflow phases
|
||||||
|
* Use 'inform' to share intermediate results without requiring user interaction
|
||||||
* Minimize blocking operations to maintain progress
|
* Minimize blocking operations to maintain progress
|
||||||
* Provide brief explanations for method/strategy changes
|
* Provide brief explanations for method/strategy changes
|
||||||
|
|
||||||
- Deliverables:
|
- Deliverables:
|
||||||
* Attach all relevant files with the 'ask' tool with 'attachments' parameter
|
* Attach all relevant files with the 'ask' or 'inform' tools using the 'attachments' parameter
|
||||||
* Share results and deliverables before entering complete state
|
* Share intermediate results with 'inform' and final deliverables with 'ask' before entering complete state
|
||||||
|
* Use 'inform' to provide progress reports with partial results
|
||||||
* Ensure users have access to all necessary resources
|
* Ensure users have access to all necessary resources
|
||||||
|
|
||||||
- Communication Tools:
|
- Communication Tools:
|
||||||
* Use 'ask' for essential questions and clarifications
|
* Use 'ask' for essential questions and clarifications that require user response
|
||||||
|
* Use 'inform' for meaningful progress updates that don't require user input
|
||||||
|
* Use 'inform' sparingly - only for significant milestones, not routine actions
|
||||||
|
* Use 'inform' to share status updates after completing major sections of work
|
||||||
|
* Use 'inform' to notify users about transitions between different phases of work
|
||||||
* Include the 'attachments' parameter with file paths or URLs when sharing resources
|
* Include the 'attachments' parameter with file paths or URLs when sharing resources
|
||||||
* Use 'complete' only when all tasks are finished and verified
|
* Use 'complete' only when all tasks are finished and verified
|
||||||
* DO NOT use 'complete' unless all todo.md items are marked [x]
|
* DO NOT use 'complete' unless all todo.md items are marked [x]
|
||||||
|
|
||||||
|
- Communication Frequency:
|
||||||
|
* Use 'inform' at natural breakpoints in the workflow
|
||||||
|
* Provide updates after completing sections in todo.md
|
||||||
|
* Avoid excessive updates for routine operations
|
||||||
|
* Balance between keeping users informed and avoiding notification fatigue
|
||||||
|
* For complex tasks, provide progress updates at 25%, 50%, 75%, and completion milestones
|
||||||
|
|
||||||
- Tool Results: Carefully analyze all tool execution results to inform your next actions
|
- Tool Results: Carefully analyze all tool execution results to inform your next actions
|
||||||
|
|
||||||
# 8. COMPLETION PROTOCOLS
|
# 8. COMPLETION PROTOCOLS
|
||||||
|
|
||||||
## 8.1 TERMINATION RULES
|
## 8.1 TERMINATION RULES
|
||||||
- IMMEDIATE COMPLETION:
|
- IMMEDIATE COMPLETION:
|
||||||
|
* After providing a final update with 'inform' about successful task completion
|
||||||
* As soon as ALL tasks in todo.md are marked [x], you MUST use 'complete' or 'ask'
|
* As soon as ALL tasks in todo.md are marked [x], you MUST use 'complete' or 'ask'
|
||||||
* No additional commands or verifications are allowed after completion
|
* No additional commands or verifications are allowed after completion
|
||||||
* No further exploration or information gathering is permitted
|
* No further exploration or information gathering is permitted
|
||||||
|
@ -415,11 +437,13 @@ For casual conversation and social interactions:
|
||||||
|
|
||||||
- COMPLETION VERIFICATION:
|
- COMPLETION VERIFICATION:
|
||||||
* Verify task completion only once
|
* Verify task completion only once
|
||||||
|
* Use 'inform' to update the user about successful verification
|
||||||
* If all tasks are complete, immediately use 'complete' or 'ask'
|
* If all tasks are complete, immediately use 'complete' or 'ask'
|
||||||
* Do not perform additional checks after verification
|
* Do not perform additional checks after verification
|
||||||
* Do not gather more information after completion
|
* Do not gather more information after completion
|
||||||
|
|
||||||
- COMPLETION TIMING:
|
- COMPLETION TIMING:
|
||||||
|
* Use 'inform' to provide a final status update before completion
|
||||||
* Use 'complete' or 'ask' immediately after the last task is marked [x]
|
* Use 'complete' or 'ask' immediately after the last task is marked [x]
|
||||||
* No delay between task completion and tool call
|
* No delay between task completion and tool call
|
||||||
* No intermediate steps between completion and tool call
|
* No intermediate steps between completion and tool call
|
||||||
|
|
|
@ -81,6 +81,74 @@ class MessageTool(Tool):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return self.fail_response(f"Error asking user: {str(e)}")
|
return self.fail_response(f"Error asking user: {str(e)}")
|
||||||
|
|
||||||
|
@openapi_schema({
|
||||||
|
"type": "function",
|
||||||
|
"function": {
|
||||||
|
"name": "inform",
|
||||||
|
"description": "Inform the user about progress, completion of a major step, or important context. Use this tool: 1) To provide updates between major sections of work, 2) After accomplishing significant milestones, 3) When transitioning to a new phase of work, 4) To confirm actions were completed successfully, 5) To provide context about upcoming steps. IMPORTANT: Use sparingly - only for meaningful updates, not routine actions. This does not require user response and allows continued execution.",
|
||||||
|
"parameters": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"text": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Information to present to the user. Include: 1) Clear statement of what has been accomplished or what is happening, 2) Relevant context or impact, 3) Brief indication of next steps if applicable."
|
||||||
|
},
|
||||||
|
"attachments": {
|
||||||
|
"anyOf": [
|
||||||
|
{"type": "string"},
|
||||||
|
{"items": {"type": "string"}, "type": "array"}
|
||||||
|
],
|
||||||
|
"description": "(Optional) List of files or URLs to attach to the information. Include when: 1) Information relates to specific files or resources, 2) Showing intermediate results or outputs, 3) Providing supporting documentation. Always use relative paths to /workspace directory."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["text"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
@xml_schema(
|
||||||
|
tag_name="inform",
|
||||||
|
mappings=[
|
||||||
|
{"param_name": "text", "node_type": "content", "path": "."},
|
||||||
|
{"param_name": "attachments", "node_type": "attribute", "path": ".", "required": False}
|
||||||
|
],
|
||||||
|
example='''
|
||||||
|
<!-- Use inform for meaningful progress updates -->
|
||||||
|
<!-- Examples of when to use inform: -->
|
||||||
|
<!-- 1. Completing major milestones -->
|
||||||
|
<!-- 2. Transitioning between work phases -->
|
||||||
|
<!-- 3. Confirming important actions -->
|
||||||
|
<!-- 4. Providing context for upcoming work -->
|
||||||
|
<!-- 5. Sharing significant intermediate results -->
|
||||||
|
|
||||||
|
<inform attachments="analysis_results.csv,summary_chart.png">
|
||||||
|
I've completed the data analysis of the sales figures. Key findings include:
|
||||||
|
- Q4 sales were 28% higher than Q3
|
||||||
|
- Product line A showed the strongest performance
|
||||||
|
- Three regions missed their targets
|
||||||
|
|
||||||
|
I'll now proceed with creating the executive summary report based on these findings.
|
||||||
|
</inform>
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
async def inform(self, text: str, attachments: Optional[Union[str, List[str]]] = None) -> ToolResult:
|
||||||
|
"""Inform the user about progress or important updates without requiring a response.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
text: The information to present to the user
|
||||||
|
attachments: Optional file paths or URLs to attach
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
ToolResult indicating the information was successfully sent
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
# Convert single attachment to list for consistent handling
|
||||||
|
if attachments and isinstance(attachments, str):
|
||||||
|
attachments = [attachments]
|
||||||
|
|
||||||
|
return self.success_response({"status": "Information sent"})
|
||||||
|
except Exception as e:
|
||||||
|
return self.fail_response(f"Error informing user: {str(e)}")
|
||||||
|
|
||||||
@openapi_schema({
|
@openapi_schema({
|
||||||
"type": "function",
|
"type": "function",
|
||||||
"function": {
|
"function": {
|
||||||
|
@ -134,4 +202,11 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
print("Question result:", ask_result)
|
print("Question result:", ask_result)
|
||||||
|
|
||||||
|
# Test inform
|
||||||
|
inform_result = await message_tool.inform(
|
||||||
|
text="Completed analysis of data. Processing results now.",
|
||||||
|
attachments="analysis.pdf"
|
||||||
|
)
|
||||||
|
print("Inform result:", inform_result)
|
||||||
|
|
||||||
asyncio.run(test_message_tool())
|
asyncio.run(test_message_tool())
|
||||||
|
|
Loading…
Reference in New Issue