What is the Task?
Agents are just like the humans. As humans we are creating some virtual steps for our tasks. Like first i will search for the websites, then i will read the content then i will categorize them. For the agents task we have the some structure. The key points for the tasks are:- Tasks are the parts of the main job: You need to create the steps to archive your main task over Task system.
- They increase the accruacy: With the small jobs agents are more focusing on what to do right now and their accuracy increases.
- You can manage the Tools and Context:: With this focusing setting the tools for the tasks the overall token usage and accuracy increases. Agents only get the required context at the right time.
Core Principles For Tasks
When you are creating a Task, ensure that you define these elements as well:- description: Each task should have a clear, actionable description that matches its purpose.
- context management: Tasks often depend on the results or context of previous tasks. Make sure to specify context when needed.
- Be specific: Provide specific instructions for what the task should accomplish and how.
Defining Description
Descriptions should be simple and actionable. Keep them short to increase accuracy. There is an tradeoff between the task number and cost. If you want to get more accurate results you need to open more tasks and split your tasks. Good DescriptionsLet’s Create task for Analyzing the Merchant Websites
In Upsonic we have a Task class and they are the core parts of anything that you do actually. When you create an task you can use that task in an Direct LLM Call, Agent and Multi-Agent teams. In this example we will add the task to our merchant Website analyzer.Adding Files and Documents to Tasks
Thecontext attribute is the comprehensive way to provide any contextual information to your tasks. This includes files, images, documents, other tasks, knowledge bases, or any other relevant data.
Adding Files to Tasks
Supported File Types
The framework automatically handles various file formats:- Images: PNG, JPEG, GIF, BMP, TIFF
- Documents: PDF, Word (.docx), Text (.txt), Markdown (.md)
- Data: CSV, JSON, XML, Excel (.xlsx)
- Code: Python (.py), JavaScript (.js), etc.
Need more advanced features?
The Task system offers several advanced configurations to enhance task management:- Structured Output: Define custom Pydantic models for structured responses, ensuring consistent and validated output formats.
- Contextual Dependencies: Define tasks with dependencies on the results or context of previous tasks, ensuring coherent workflows.
- Tool Assignment: Assign specific tools to tasks to optimize resource usage and improve accuracy.
- Caching Mechanisms: Implement intelligent caching with vector search or LLM-based similarity matching to reduce redundant processing.
- Guardrail Validation: Apply custom validation functions with retry logic to ensure task outputs meet specific quality standards.
- External Execution: Configure tasks to pause for external tool execution, enabling integration with external systems and human-in-the-loop workflows.
-
Comprehensive Context: Include any contextual information in the
contextattribute - files, images, documents, other tasks, knowledge bases, or any other relevant data for multimodal processing capabilities. - Context Integration: Leverage knowledge bases and RAG systems to provide rich contextual information for task execution.
- Performance Monitoring: Track task execution metrics including duration, token usage, and cost analysis.

