API Reference
Task Module
Documentation for the praisonaiagents.task.task module
Module praisonaiagents.task.task
Classes
Task
Represents a task to be executed by an agent.
Parameters
description: str
- Task descriptionexpected_output: str
- Expected output descriptionagent: Agent | None = None
- Agent assigned to the taskname: str | None = None
- Task nametools: List[Any] | None = None
- Tools available for the taskcontext: List[Task] | None = None
- Context from other tasksasync_execution: bool | None = False
- Enable async executionconfig: Dict[str, Any] | None = None
- Task configurationoutput_file: str | None = None
- Output file pathoutput_json: Type[BaseModel] | None = None
- JSON output schemaoutput_pydantic: Type[BaseModel] | None = None
- Pydantic output schemacallback: Any | None = None
- Task callbackstatus: str = 'not started'
- Task statusresult: TaskOutput | None = None
- Task resultcreate_directory: bool | None = False
- Create output directoryid: int | None = None
- Task IDimages: List[str] | None = None
- Task imagesnext_tasks: List[str] | None = None
- Next taskstask_type: str = 'task'
- Task typecondition: Dict[str, List[str]] | None = None
- Task conditionsis_start: bool = False
- Is start taskloop_state: Dict[str, str | int] | None = None
- Loop state
Async Support
The Task class supports asynchronous execution through the following features:
async_execution
: Boolean flag to enable async executioncallback
: Supports both sync and async callback functionsexecute_callback
: Internal async method for handling callbacks
Example usage:
Callback Types
The Task class supports both synchronous and asynchronous callbacks:
Async Task States
not started
: Initial statein progress
: Task is being executedcompleted
: Task finished successfullyfailed
: Task execution failed
Was this page helpful?