HKUDS/DeepTutor · error · RuntimeError

The installed codebuddy-agent-sdk does not accept the turn l

Error message

The installed codebuddy-agent-sdk does not accept the turn limit and permission mode this provider requires. Install a supported version (pip install "deeptutor[codebuddy]").

What it means

_build_options() tries several candidate kwargs for the SDK's options class (turn limit, permission mode) and every attempt raised TypeError — the installed SDK's options object doesn't accept those parameters. This is an SDK/provider version mismatch: the provider requires newer options fields the installed SDK lacks (or renamed).

Source

Thrown at deeptutor/services/llm/provider_core/codebuddy_provider.py:440

        {"maxTurns": 1, "permissionMode": "plan"},
    ):
        restricted = {
            **model_kwargs,
            **env_kwargs,
            **reasoning_kwargs,
            **tool_kwargs,
            **guard,
        }
        if max_tokens > 0:
            candidates.append({**restricted, "max_tokens": max_tokens})
        candidates.append(restricted)

    for kwargs in candidates:
        try:
            return options_cls(**kwargs)
        except TypeError:
            continue
    raise RuntimeError(
        "The installed codebuddy-agent-sdk does not accept the turn limit and "
        "permission mode this provider requires. Install a supported version "
        '(pip install "deeptutor[codebuddy]").'
    )


def _build_tool_options(sdk: ModuleType, tools: list[dict[str, Any]] | None) -> dict[str, Any]:
    if not tools:
        return {"tools": []}
    decorate = getattr(sdk, "tool", None)
    create_server = getattr(sdk, "create_sdk_mcp_server", None)
    if not callable(decorate) or not callable(create_server):
        return {"tools": []}

    sdk_tools: list[Callable[..., Any]] = []
    allowed: list[str] = []
    for schema in tools:
        function = schema.get("function") if isinstance(schema, dict) else None

View on GitHub (pinned to 3e82f13042)

Solutions

  1. pip install "deeptutor[codebuddy]" to get the supported SDK version.
  2. Verify with pip show codebuddy-agent-sdk that the version matches deeptutor's constraint.
  3. If you must use an older SDK, pin the matching older deeptutor release.

Example fix

# before
pip install codebuddy-agent-sdk==0.1.0  # old options signature

# after
pip install "deeptutor[codebuddy]"
Defensive patterns

Strategy: validation

Validate before calling

import inspect, codebuddy_agent_sdk
opts = getattr(codebuddy_agent_sdk, "Options", None)
if opts is None or not any("permission" in p for p in inspect.signature(opts).parameters):
    print("Unsupported SDK version — pip install 'deeptutor[codebuddy]'")

Type guard

def sdk_options_compatible() -> bool:
    try:
        import inspect
        from codebuddy_agent_sdk import Options
        params = inspect.signature(Options).parameters
        return any("permission" in p for p in params)
    except Exception:
        return False

Try / catch

try:
    result = provider.run_one_shot(...)
except RuntimeError as e:
    if "does not accept the turn limit" in str(e):
        logger.error("Upgrade: pip install 'deeptutor[codebuddy]'")
    raise

Prevention

When it happens

Trigger: Running _run_one_shot or _get_session with an older codebuddy-agent-sdk whose options class has different constructor signatures; provider code updated to pass max_turns/permission_mode but SDK not upgraded.

Common situations: Upgrading deeptutor without upgrading the codebuddy extra, mixed lockfile versions, vendored or forked SDKs with diverging signatures.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/cadec811a89ff2bc. Report an issue: GitHub.