Skip to content

Plan discover

PlanDiscoverOperator

Bases: Operator

Plan discover operator that searches for top-level operators as plan starters, given a task and data

Attributes:

Name Type Required Default Description
task str "" Task to discover plans/operators
data str "" Data to operate the task on
approximate bool True Whether to use approximate (vector) search
hybrid bool False Whether to use hybrid search (text + vector)
limit int -1 Max number of results to return (-1 for unlimited)
page int 0 Page number for pagination
page_size int 10 Number of results per page (default: 10, max: 100)
include_metadata bool False Whether to include metadata in results (description and properties always included)
threshold float 0.5 Similarity threshold for filtering results (0.0-1.0, lower = more similar; applies to approximate/hybrid search)
progressive_pagination bool False Whether to use progressive pagination for approximate/hybrid search (searches all pages until threshold exceeded)
Source code in blue/operators/plan_discover.py
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
class PlanDiscoverOperator(Operator):
    """
    Plan discover operator that searches for top-level operators as plan starters, given a task and data

    Attributes:
    ----------
    | Name                    | Type  | Required | Default | Description                                                                                       |
    |-------------------------|-------|----------|---------|---------------------------------------------------------------------------------------------------|
    | `task`                  | str   | :fontawesome-solid-circle-check: {.green-check}     | ""      | Task to discover plans/operators                                                                 |
    | `data`                  | str   | :fontawesome-solid-circle-check: {.green-check}     | ""      | Data to operate the task on                                                                      |
    | `approximate`           | bool  | :fontawesome-solid-circle-check: {.green-check}     | True    | Whether to use approximate (vector) search                                                      |
    | `hybrid`                | bool  |     | False   | Whether to use hybrid search (text + vector)                                                   |
    | `limit`                 | int   |     | -1      | Max number of results to return (-1 for unlimited)                                             |
    | `page`                  | int   |     | 0       | Page number for pagination                                                                      |
    | `page_size`             | int   |     | 10      | Number of results per page (default: 10, max: 100)                                             |
    | `include_metadata`      | bool  |     | False   | Whether to include metadata in results (description and properties always included)            |
    | `threshold`             | float |     | 0.5     | Similarity threshold for filtering results (0.0-1.0, lower = more similar; applies to approximate/hybrid search) |
    | `progressive_pagination`| bool  |     | False   | Whether to use progressive pagination for approximate/hybrid search (searches all pages until threshold exceeded) |
    """

    PROPERTIES = {}

    name = "plan_discover"
    description = "Discovers plans using the operator registry to search for top-level operators as plan starters"
    default_attributes = {
        "task": {"type": "str", "description": "Task to discover plans/operators", "required": True, "default": ""},
        "data": {"type": "str", "description": "Data to operate the task on", "required": True, "default": ""},
        "approximate": {"type": "bool", "description": "Whether to use approximate (vector) search", "required": True, "default": True},
        "hybrid": {"type": "bool", "description": "Whether to use hybrid search (text + vector)", "required": False, "default": False},
        "limit": {"type": "int", "description": "Max number of results to return (-1, unlimited)", "required": False, "default": -1},
        "page": {"type": "int", "description": "Page number for pagination", "required": False, "default": 0},
        "page_size": {"type": "int", "description": "Number of results per page (default: 10, max: 100)", "required": False, "default": 10},
        "include_metadata": {"type": "bool", "description": "Whether to include metadata in results (description and properties always included)", "required": False, "default": False},
        "threshold": {
            "type": "float",
            "description": "Similarity threshold for filtering results (0.0-1.0, lower = more similar, only applies to approximate/hybrid search)",
            "required": False,
            "default": 0.5,
        },
        "progressive_pagination": {
            "type": "bool",
            "description": "Whether to use progressive pagination for approximate/hybrid search (searches all pages until threshold exceeded)",
            "required": False,
            "default": False,
        },
    }

    def __init__(self, description: str = None, properties: Dict[str, Any] = None):
        super().__init__(
            self.name,
            function=plan_discover_operator_function,
            description=description or self.description,
            properties=properties,
            validator=plan_discover_operator_validator,
            explainer=plan_discover_operator_explainer,
            refiner=plan_discover_operator_refiner,
        )

    def _initialize_properties(self):
        super()._initialize_properties()

        # attribute definitions
        self.properties["attributes"] = self.default_attributes

        # refine
        self.properties["refine"] = True

plan_discover_operator_explainer(output, input_data, attributes)

Explain plan discover operator output.

Source code in blue/operators/plan_discover.py
79
80
81
82
83
84
85
86
87
def plan_discover_operator_explainer(output: Any, input_data: List[List[Dict[str, Any]]], attributes: Dict[str, Any]) -> Dict[str, Any]:
    """Explain plan discover operator output."""
    plan_discover_explanation = {
        'output': output,
        'input_data': input_data,
        'attributes': attributes,
        'explanation': f"plan discover operator searched for top-level operators with query '{attributes.get('search_query', '')}' and returned {len(output[0]) if output and len(output) > 0 else 0} results.",
    }
    return plan_discover_explanation

plan_discover_operator_validator(input_data, attributes, properties=None)

Validate operator discover operator attributes.

Source code in blue/operators/plan_discover.py
74
75
76
def plan_discover_operator_validator(input_data: List[List[Dict[str, Any]]], attributes: Dict[str, Any], properties: Dict[str, Any] = None) -> bool:
    """Validate operator discover operator attributes."""
    return operator_discover_operator_validator(input_data, attributes=attributes, properties=properties)
Last update: 2025-10-09