JuliusBrussee/caveman · error · ValueError

strategy must be all or deferred

Error message

strategy must be all or deferred

What it means

Error "strategy must be all or deferred" thrown in JuliusBrussee/caveman.

Source

Thrown at packages/sdk/python/caveman_cloud/core.py:654

        max_loaded_tools: int | None = None,
    ) -> "_ToolsHandle":
        """Build a tool-catalog handle with server-side search via
        ``/sdk/v1/tool-search``.

        ``strategy="all"``      → ``initial`` is the whole catalog; ``search()``
                                  still calls the server.
        ``strategy="deferred"`` → ``initial`` is the ``always_load`` tools plus
                                  the first ``initial_tool_count`` of the catalog
                                  (a subset sent on the first turn); ``search()``
                                  calls the server to load relevant tools on demand.

        Returns a handle with ``.strategy``, ``.initial`` (a ``list[CaveTool]``),
        and ``.search(query, *, max_tools, context, workflow, ranker)`` which
        hits the gateway and returns a :class:`ToolSearchResult`. Mirrors the
        TypeScript ``cave.tools({ catalog, strategy })``.
        """
        if strategy not in {"all", "deferred"}:
            raise ValueError("strategy must be all or deferred")
        if isinstance(initial_tool_count, bool) or not isinstance(initial_tool_count, int) or initial_tool_count < 0:
            raise ValueError("initial_tool_count must be a non-negative integer")
        if max_loaded_tools is not None and (isinstance(max_loaded_tools, bool) or not isinstance(max_loaded_tools, int) or max_loaded_tools < 1):
            raise ValueError("max_loaded_tools must be a positive integer")
        if strategy == "all":
            initial = list(catalog)
        else:
            always = [t for t in catalog if t.always_load]
            if max_loaded_tools is not None and len(always) > max_loaded_tools:
                raise ValueError("max_loaded_tools must be at least the always_load tool count")
            lazy = [t for t in catalog if not t.always_load]
            lazy_limit = initial_tool_count if max_loaded_tools is None else min(initial_tool_count, max_loaded_tools - len(always))
            initial = always + lazy[:lazy_limit]
        return _ToolsHandle(self, catalog, strategy, initial, max_loaded_tools)

    def tool_search(
        self,
        tools: list[CaveTool],

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Set strategy to "all" or "deferred".

When it happens

Trigger: Thrown at packages/sdk/python/caveman_cloud/core.py:654 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/24377828a36f4e94. Report an issue: GitHub.