Module praisonaiagents.agents.agents
Functions
encode_file_to_base64(file_path: str) → str
Base64-encode a file.process_video(video_path: str, seconds_per_frame=2)
Split video into frames (base64-encoded).Classes
LoopItems
A Pydantic model for handling loop items.Class Variables
items: List[Any]- List of items to loop throughmodel_config- Model configuration
PraisonAIAgents
The main class for managing agents and tasks execution.Parameters
agents: List[Agent]- List of agentstasks: List[Task]- List of tasksverbose: int = 0- Verbosity levelcompletion_checker: Optional[Callable] = None- Custom completion checkermax_retries: int = 5- Maximum retry attemptsprocess: str = "sequential"- Process type (sequential, workflow, hierarchical)manager_llm: Optional[str] = None- Language model for manager agent
Methods
add_task(self, task)- Add a task to the crewclean_json_output(self, output: str) → str- Clean JSON outputclear_state(self) → None- Clear all state valuesdefault_completion_checker(self, task, agent_output)- Default completion checkerexecute_task(self, task_id)- Execute a specific taskget_agent_details(self, agent_name)- Get agent detailsget_all_tasks_status(self)- Get status of all tasksget_state(self, key: str, default: Any = None) → Any- Get a state valueget_task_details(self, task_id)- Get task detailsget_task_result(self, task_id)- Get task resultget_task_status(self, task_id)- Get task statusrun_all_tasks(self)- Execute tasks based on execution moderun_task(self, task_id)- Run a specific tasksave_output_to_file(self, task, task_output)- Save task output to fileset_state(self, key: str, value: Any) → None- Set a state valuestart(self)- Start the crew executionupdate_state(self, updates: Dict) → None- Update multiple state values
Async Methods
astart(self)- Async version of start methodaexecute_task(self, task_id)- Async version of execute_taskarun_task(self, task_id)- Async version of run_taskarun_all_tasks(self)- Async version of run_all_tasks
Async Support
The PraisonAIAgents class provides comprehensive async support through the following methods:Async Features
- Full async/await support
- Parallel task execution
- Non-blocking operations
- Efficient resource utilization
- Mixed sync/async task handling
- Async process management

