The CollaborationWorkflow class implements a workflow that utilizes team collaboration and tool usage for task completion. It's designed to be used within an Agent instance and extends the functionality of the BaseWorkflow class.
llm
: The language model used by the workflowtask
: The task to be performedverbose
: Flag for enabling verbose modechannel
: The collaboration channel for communicationteam_work
: The team worker componenttool
: The tool worker component
Initializes a CollaborationWorkflow instance with the following parameters:
llm
: The language modeltask
: The assigned taskverbose
: Flag for verbose mode (default: False)max_attempts
: Maximum attempts for model responses (default: 3)
Internal method that executes the main workflow process:
- Sets the task status to WORKING
- Runs the tool component if tools are available
- Runs the team work component
- Sets the task status to COMPLETED
Public method to initiate the workflow execution.
To use the CollaborationWorkflow with an Agent:
from rexia_ai.workflows import CollaborationWorkflow
from rexia_ai.agent import Agent
llm = ... # Your language model instance
task = "Collaborate on a research project and summarize findings."
agent = Agent(
llm=llm,
task=task,
workflow=CollaborationWorkflow,
verbose=True
)
result = agent.invoke()
print(result)
This workflow enhances task-solving capabilities by incorporating team collaboration and tool usage, making it suitable for complex tasks that require multiple steps or expertise.