HKUDS/DeepTutor · error · RuntimeError
Installed codebuddy-agent-sdk does not expose query().
Error message
Installed codebuddy-agent-sdk does not expose query().
What it means
The codebuddy-agent-sdk package IS installed, but it doesn't expose the `query()` function this provider's integration contract requires — meaning an incompatible or outdated SDK version was installed. _load_sdk() validates the API surface after import and raises RuntimeError.
Source
Thrown at deeptutor/services/llm/provider_core/codebuddy_provider.py:379
if task is not None:
task.uncancel()
except Exception:
pass
def get_default_model(self) -> str:
return self.default_model
def _load_sdk() -> ModuleType:
try:
import codebuddy_agent_sdk
except ImportError as exc: # pragma: no cover - optional dependency
raise RuntimeError(
"codebuddy-agent-sdk is not installed. Install it with "
"`python -m pip install codebuddy-agent-sdk` or `pip install -e .[codebuddy]`."
) from exc
if not hasattr(codebuddy_agent_sdk, "query"):
raise RuntimeError("Installed codebuddy-agent-sdk does not expose query().")
return codebuddy_agent_sdk
def _strip_model_prefix(model: str | None) -> str | None:
if not model:
return None
if "/" not in model:
return model
prefix, value = model.split("/", 1)
if prefix.lower().replace("-", "_") in {"codebuddy", "codebuddy_code", "workbuddy"}:
return value
return model
def _build_options(
sdk: ModuleType,
model: str | None,
max_tokens: int,View on GitHub (pinned to 3e82f13042)
Solutions
- Install the version the provider pins: pip install "deeptutor[codebuddy]" which resolves a compatible SDK.
- Check the installed version (pip show codebuddy-agent-sdk) and compare with deeptutor's requirement.
- Downgrade/upgrade to the version whose module exposes query().
Example fix
# before pip install codebuddy-agent-sdk # latest, API changed # after pip install "deeptutor[codebuddy]" # resolves compatible SDK version
Defensive patterns
Strategy: validation
Validate before calling
import codebuddy_agent_sdk
if not hasattr(codebuddy_agent_sdk, "query"):
print("Incompatible codebuddy-agent-sdk version; reinstall via pip install 'deeptutor[codebuddy]'") Type guard
def sdk_has_query() -> bool:
try:
import codebuddy_agent_sdk as sdk
except ImportError:
return False
return hasattr(sdk, "query") Try / catch
try:
...
except RuntimeError as e:
if "does not expose query" in str(e):
subprocess.run([sys.executable, "-m", "pip", "install", "deeptutor[codebuddy]"])
raise Prevention
- Install the codebuddy extra rather than the bare SDK so versions stay coupled.
- Add a startup capability check (sdk_has_query()) before enabling the provider.
- Lock dependency versions in CI to catch SDK drift.
When it happens
Trigger: An older/newer fork of codebuddy-agent-sdk where query() was renamed or removed; installing the SDK from PyPI while the provider expects the deeptutor-pinned version.
Common situations: Version drift after `pip install -U codebuddy-agent-sdk`, a lockfile pinning an old version, or a renamed API in a major SDK release.
Related errors
- The installed codebuddy-agent-sdk does not accept the turn l
- DashScope response missing `output` (request_id={getattr(res
- OpenAI API key is not configured. Set it in Settings > Catal
- codebuddy-agent-sdk is not installed. Install it with `pytho
- CodeBuddy CLI is required to sync account models.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/418c49f9ab24e54c.
Report an issue: GitHub.