AgentPool
- base_agent (ChatAgent): The base agent to clone from.
- initial_size (int): Initial number of agents in the pool. (default: :obj:
1) - max_size (int): Maximum number of agents in the pool. (default: :obj:
10) - auto_scale (bool): Whether to automatically scale the pool size. (default: :obj:
True) - idle_timeout (float): Time in seconds after which idle agents are removed. (default: :obj:
180.0) - cleanup_interval (float): Fixed interval in seconds between cleanup checks. (default: :obj:
60.0)
init
_initialize_pool
_create_fresh_agent
get_stats
SingleAgentWorker
- description (str): Description of the node.
- worker (ChatAgent): Worker of the node. A single agent.
- use_agent_pool (bool): Whether to use agent pool for efficiency. (default: :obj:
True) - pool_initial_size (int): Initial size of the agent pool. (default: :obj:
1) - pool_max_size (int): Maximum size of the agent pool. (default: :obj:
10) - auto_scale_pool (bool): Whether to auto-scale the agent pool. (default: :obj:
True) - use_structured_output_handler (bool, optional): Whether to use the structured output handler instead of native structured output. When enabled, the workforce will use prompts with structured output instructions and regex extraction to parse responses. This ensures compatibility with agents that don’t reliably support native structured output. When disabled, the workforce uses the native response_format parameter. (default: :obj:
True) - context_utility (ContextUtility, optional): Shared context utility instance for workflow management. If provided, all workflow operations will use this shared instance instead of creating a new one. This ensures multiple workers share the same session directory. (default: :obj:
None) - enable_workflow_memory (bool, optional): Whether to enable workflow memory accumulation during task execution. When enabled, conversations from all task executions are accumulated for potential workflow saving. Set to True if you plan to call save_workflow_memories(). (default: :obj:
False)
init
reset
_get_context_utility
_get_conversation_accumulator
_get_workflow_manager
get_pool_stats
save_workflow_memories
- status (str): “success” or “error”
- summary (str): Generated workflow summary
- file_path (str): Path to saved file
- worker_description (str): Worker description used
save_workflow_memories_async: Async version for better
performance in parallel workflows.
load_workflow_memories
- pattern (Optional[str]): Legacy parameter for backward compatibility. When use_smart_selection=False, uses this pattern for file matching. Ignored when smart selection is enabled.
- max_workflows (int): Maximum number of workflow files to load. (default: :obj:
3) - session_id (Optional[str]): Specific workforce session ID to load from. If None, searches across all sessions. (default: :obj:
None) - use_smart_selection (bool): Whether to use agent-based intelligent workflow selection. When True, uses metadata and LLM to select most relevant workflows. When False, falls back to pattern matching. (default: :obj:
True)