π― Planning and Reasoning
DroidRunβs planning system allows the DroidAgent to break down complex goals into manageable tasks.π Overview
When thereasoning=True parameter is enabled, DroidAgent uses a PlannerAgent to:
- Analyze the user goal
- Break it down into sequential tasks
- Track task execution
- Adapt plans based on results
π How Planning Works
1
Task Analysis
The PlannerAgent receives the userβs goal and analyzes what needs to be done
2
Task Generation
PlannerAgent creates a task list using the TaskManager
3
Sequential Execution
Tasks are executed one by one using the CodeActAgent
4
Progress Tracking
Successfully completed tasks are marked and failed tasks are noted
5
Plan Adjustment
After tasks are executed, the plan is revisited and updated as needed
π οΈ Task Management
The TaskManager component handles:π Task History
The DroidAgent maintains a complete task history:βοΈ Using Planning
Enable planning during agent creation:π Memory and Context
The planning system maintains context between iterations:- Task History: Keeps track of completed and failed tasks
- Memory Storage: Remembers important information via tools.remember()
- Execution Details: Stores tool execution results
π§ When to Use Planning
Planning is most effective for:Complex Goals
Multi-step operations requiring coordination
Error-Prone Tasks
Operations that may require retries or error handling
Dynamic Workflows
Tasks where next steps depend on previous results
UI Workflows
Navigation through multiple app screens
π‘ Best Practices
-
Clear Goal Description
- Be specific about what you want to achieve
- Include success criteria when possible
-
Appropriate Step Limits
- Increase max_steps for complex workflows
- Consider device and network performance
-
Error Handling
- Check task_history for debugging failed tasks
-
Memory Usage
- Use tools.remember() for key information
- Include discovered data in task descriptions