Tasks enable agents to break down complex objectives into manageable units of work, track progress, and coordinate execution across multiple steps and agents.
Overview
The Tasks primitive provides a structured way to define, assign, execute, and monitor discrete units of work. Unlike workflows which define processes, tasks represent individual actionable items that can be tracked, prioritized, and completed independently or as part of larger objectives. Tasks are essential for:- Work Breakdown: Decompose complex goals into manageable chunks
- Progress Tracking: Monitor completion status and progress
- Prioritization: Organize work by importance and urgency
- Delegation: Assign tasks to specific agents or humans
- Dependencies: Define task relationships and execution order
- Accountability: Track who did what and when
Task Creation
Agents can create tasks autonomously or from user requests
Status Tracking
Track task lifecycle from creation to completion
Dependencies
Define task relationships and execution order
Collaboration
Assign tasks to agents or human team members
How Tasks Work
When you enable tasks for an agent:- Creation: Tasks are created with description, priority, and metadata
- Assignment: Tasks assigned to agents or humans with appropriate context
- Execution: Assigned party works on and completes task
- Tracking: Status updates tracked throughout lifecycle
- Completion: Task marked complete with results and artifacts
- Review: Optional review and approval processes
Persistent State: Tasks persist across sessions and can be resumed at any time, making them ideal for long-running work.
Task States
Lifecycle States
- pending: Task created but not started
- in_progress: Actively being worked on
- blocked: Waiting for dependency or external input
- completed: Successfully finished
- cancelled: Abandoned or no longer needed
Priority Levels
Code Examples
Basic Task Creation
Create Task Manually
Task with Dependencies
Assign Task to Agent
Query Tasks
Update Task Status
Recurring Tasks
Task Templates
Use Cases
1. Project Management
Break down projects into trackable tasks:2. Content Creation Pipeline
Manage content creation workflow:3. Customer Onboarding
Automate onboarding task creation:4. Incident Response
Create incident resolution tasks:5. Daily Standup Automation
Generate daily task summaries:6. Sales Pipeline Tasks
Track sales activities:Best Practices
Task Design
Keep Tasks Atomic
Keep Tasks Atomic
Use Clear Descriptions
Use Clear Descriptions
Set Realistic Due Dates
Set Realistic Due Dates
Task Management
Prioritize Effectively
Prioritize Effectively
Handle Blocked Tasks
Handle Blocked Tasks
Track Time and Progress
Track Time and Progress
Archive Completed Tasks
Archive Completed Tasks
Collaboration
Assign Tasks Appropriately
Assign Tasks Appropriately
Add Context and Resources
Add Context and Resources
Enable Comments and Updates
Enable Comments and Updates
Integration with Other Primitives
With Workflow
Combine tasks with workflows:With Memory
Remember task preferences:With Scheduling
Schedule task creation:Performance Considerations
Task Volume
- Scalability: System handles thousands of active tasks
- Query Performance: Index tasks by status, priority, assignee
- Archival: Archive completed tasks to maintain performance
Real-time Updates
- Webhooks: Receive real-time task updates
- Polling: Query for task changes periodically
- WebSocket: Subscribe to live task updates
Troubleshooting
Tasks Not Being Created
Tasks Not Being Created
Problem: Agent doesn’t create tasks as expectedSolutions:
- Verify tasks capability is enabled
- Check system prompt includes task creation instructions
- Ensure agent has permissions to create tasks
- Review agent response for task creation attempts
Dependency Deadlock
Dependency Deadlock
Problem: Circular dependencies preventing task completionSolutions:
- Review task dependency graph
- Identify circular references
- Break circular dependencies
- Update task dependencies
Task Overload
Task Overload
Problem: Too many tasks overwhelming assigneesSolutions:
- Balance task distribution
- Adjust priorities
- Delegate or reassign tasks
- Extend deadlines
Advanced Patterns
Task Automation
Auto-complete simple tasks:Task Templates with Variations
Create flexible templates:Smart Task Routing
Route tasks based on content:Related Primitives
Workflow
Orchestrate multi-step processes with tasks
Scheduling
Schedule recurring task creation
Memory
Remember task patterns and preferences
Multi-Agent
Distribute tasks across specialized agents
Additional Resources
API Reference
Complete tasks API documentation
Task Templates
Pre-built task templates library
Best Practices
Task management strategies