Tasks
Tasks are the primary way to define work for Aesoperator to perform. A Task represents a high-level goal or objective that will be broken down into a series of actions and function calls.
Task Structure
A Task consists of:
from aesoperator import Task, TaskConfig
task = Task(
name="research_topic",
description="Research and summarize information about a given topic",
config=TaskConfig(
max_pages=10,
max_duration_seconds=300,
allowed_domains=["wikipedia.org", "arxiv.org"]
),
inputs={
"topic": "artificial intelligence",
"depth": "technical"
},
memory_scope="session"
)Key components:
name: Unique identifier for the taskdescription: Human-readable description of what the task doesconfig: Runtime constraints and settingsinputs: Input parameters that control task behaviormemory_scope: How long to persist memory ("session", "permanent", etc.)
Task Configuration
The TaskConfig object lets you control how the task executes:
Executing Tasks
Tasks can be executed synchronously or asynchronously:
Task Lifecycle
A task goes through several states during execution:
pending: Task is queued for executionrunning: Task is actively executingcompleted: Task finished successfullyfailed: Task encountered an errorcancelled: Task was manually cancelled
You can monitor task progress and get detailed status:
Task Memory
Tasks can read and write to memory that persists across function calls:
Task Composition
Tasks can be composed into larger workflows:
Example Tasks
Web Research Task
Data Processing Task
Monitoring Task
Best Practices
Set appropriate resource limits in TaskConfig to prevent runaway tasks
Use memory scoping to control data persistence
Break complex workflows into smaller composed tasks
Include good descriptions and documentation
Handle errors and implement retries for reliability
Monitor task progress and set up alerting
Clean up resources when tasks complete
Learn More
Task API Reference for complete API details
Task Patterns for common task patterns and recipes
Task Monitoring for monitoring and debugging tasks
Task Security for security best practices
Last updated