JuliusBrussee/caveman · error · ValueError

max_tools must be a positive integer

Error message

max_tools must be a positive integer

What it means

Error "max_tools must be a positive integer" thrown in JuliusBrussee/caveman.

Source

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

        Args:
            tools: Full tool catalog to filter.
            query: The user's current intent / task description.
            context: Optional additional context for the search.
            max_tools: Optional cap on returned tools (server default applies if omitted).
            workflow: Override workflow label (defaults to Cave.default_workflow).
            ranker: Optional ranking algorithm passed through to the gateway
                ("bm25" default, or "embeddings" when the gateway has an embedding
                provider wired). The SDK passes it through; it never computes
                similarity itself.
            session_id: Optional server-side tool session id for later
                provider-request reinjection.

        Returns:
            ToolSearchResult with .tools, .sent_schema_tokens, .full_schema_tokens,
            .deferred_count, .method, .saved_tokens, .reduction_pct.
        """
        if max_tools is not None and (isinstance(max_tools, bool) or not isinstance(max_tools, int) or max_tools < 1):
            raise ValueError("max_tools must be a positive integer")
        body: dict[str, Any] = {
            "tools": [
                {
                    "name": t.name,
                    "description": t.description,
                    "input_schema": t.input_schema,
                    "read_only": t.read_only,
                    "idempotent": t.idempotent,
                    "always_load": t.always_load,
                }
                for t in tools
            ],
            "query": query,
        }
        if context is not None:
            body["context"] = context
        if max_tools is not None:
            body["max_tools"] = max_tools

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Set max_tools to a positive integer.

When it happens

Trigger: Thrown at packages/sdk/python/caveman_cloud/core.py:704 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/a4dfdfaa64c43bae. Report an issue: GitHub.