WorkflowSelectionMethod
- AGENT_SELECTED: Agent-based intelligent selection using metadata.
- ROLE_NAME_MATCH: Pattern matching by role_name.
- MOST_RECENT: Fallback to most recent workflows.
- ALL_AVAILABLE: Returned all workflows (fewer than max requested).
- NONE: No workflows available.
WorkflowMemoryManager
- worker (ChatAgent): The worker agent that will use workflows.
- description (str): Description of the worker’s role.
- context_utility (Optional[ContextUtility]): Shared context utility for workflow operations. If None, creates a new instance.
- role_identifier (Optional[str]): Role identifier for organizing workflows by role. If provided, workflows will be stored in role-based folders. If None, uses default workforce context.
- config (Optional[WorkflowConfig]): Configuration for workflow management. If None, uses default configuration.
init
_get_context_utility
_extract_existing_workflow_metadata
- file_path (Path): Path to the existing workflow file.
_try_role_based_loading
- role_name (str): Role name to load workflows from.
- pattern (Optional[str]): Custom search pattern for workflow files.
- max_files_to_load (int): Maximum number of workflow files to load.
- use_smart_selection (bool): Whether to use agent-based selection.
_try_session_based_loading
- session_id (str): Workforce session ID to load from.
- role_name (str): Role name (for deprecation warning).
- pattern (Optional[str]): Custom search pattern for workflow files.
- max_files_to_load (int): Maximum number of workflow files to load.
- use_smart_selection (bool): Whether to use agent-based selection.
_session_based_smart_loading
- session_id (str): Session ID to load from.
- max_files_to_load (int): Maximum number of files to load.
_session_based_pattern_loading
- pattern (Optional[str]): Pattern for file matching.
- session_id (str): Session ID to load from.
- max_files_to_load (int): Maximum number of files to load.
load_workflows
- 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_files_to_load (Optional[int]): Maximum number of workflow files to load. If None, uses config.default_max_files_to_load. (default: :obj:
None) - session_id (Optional[str]): Deprecated. Specific workforce session ID to load from using legacy session-based organization. (default: :obj:
None) - use_smart_selection (bool): Whether to use agent-based intelligent workflow selection. When True, uses workflow information and LLM to select most relevant workflows. When False, falls back to pattern matching. (default: :obj:
True)
load_workflows_by_role
- role_name (Optional[str]): Role name to load workflows from. If None, uses the worker’s role_name or role_identifier.
- pattern (Optional[str]): Custom search pattern for workflow files. Ignored when use_smart_selection=True.
- max_files_to_load (Optional[int]): Maximum number of workflow files to load. If None, uses config.default_max_files_to_load. (default: :obj:
None) - use_smart_selection (bool): Whether to use agent-based intelligent workflow selection. When True, uses workflow information and LLM to select most relevant workflows. When False, falls back to pattern matching. (default: :obj:
True)
save_workflow
- conversation_accumulator (Optional[ChatAgent]): Optional accumulator agent with collected conversations. If provided, uses this instead of the main worker agent.
- status (str): “success” or “error”
- summary (str): Generated workflow summary
- file_path (str): Path to saved file
- worker_description (str): Worker description used
_select_relevant_workflows
- workflows_metadata (List[Dict[str, Any]]): List of workflow information dicts (contains title, description, tags, file_path).
- max_files (int): Maximum number of workflows to select.
- session_id (Optional[str]): Specific workforce session ID to search in for fallback pattern matching. If None, searches across all sessions. (default: :obj:
None)
_format_workflows_for_selection
- workflows_metadata (List[Dict[str, Any]]): List of workflow information dicts (contains title, description, tags, file_path).
_find_workflow_files
_find_workflow_files_by_role for
role-based organization instead.
Parameters:
- pattern (Optional[str]): Custom search pattern for workflow files. If None, uses worker role_name to generate pattern.
- session_id (Optional[str]): Specific session ID to search in. If None, searches across all sessions.
_find_workflow_files_by_role
- role_name (Optional[str]): Role name to search for. If None, uses the worker’s role_name or role_identifier.
- pattern (Optional[str]): Custom search pattern for workflow files. If None, searches for all workflow files in the role directory.
_collect_workflow_contents
- workflow_files (List[str]): List of workflow file paths to load.
_format_workflows_for_context
- workflows_to_load (List[Dict[str, str]]): List of workflow dicts with ‘filename’ and ‘content’ keys.
_add_workflows_to_system_message
- workflow_context (str): The formatted workflow context to add.
_load_workflow_files
- workflow_files (List[str]): List of workflow file paths to load.
- max_workflows (int): Maximum number of workflows to load.