Workforce
class is the central orchestrator. It manages the entire lifecycle of a multi-agent task.description
: A high-level description of the workforce’s purpose.children
: A list of initial worker nodes.coordinator_agent
: A ChatAgent
for assigning tasks.task_agent
: A ChatAgent
for decomposing tasks.new_worker_agent
: A template ChatAgent
for creating new workers.share_memory
: If True
, SingleAgentWorker
instances will share memory.use_structured_output_handler
: Defaults to True
. Enables structured output handling so models without native JSON + tool-calling can still interop reliably.ChatAgent
configured with specific tools and a system prompt. For efficiency, it uses an AgentPool
to reuse agent instances.RolePlaying
session between two agents (an assistant and a user) to accomplish a task. It’s useful for brainstorming, debate, or exploring a topic from multiple perspectives.SingleAgentWorker
instances to your workforce.Workforce
manages a sophisticated task lifecycle.task_agent
breaks the main task into smaller, self-contained subtasks.coordinator_agent
assigns each subtask to the most suitable worker.Workforce
initiates its recovery protocols.HumanToolkit
. Agents can then call a human during execution (e.g., to clarify requirements, approve actions, or unblock errors).HumanToolkit
tool.process_task_async
is available, but it is not required for HITL.workforce
module uses several Pydantic models to ensure structured data exchange.WorkerConf
: Defines the configuration for a new worker.TaskResult
: Represents the output of a completed task.TaskAssignment
: A single task-to-worker assignment, including dependencies.TaskAssignResult
: A list of TaskAssignment
objects.RecoveryDecision
: The output of the failure analysis process, dictating the recovery strategy.