HKUDS/DeepTutor · error · RuntimeError
codebuddy-agent-sdk is not installed. Install it with `pytho
Error message
codebuddy-agent-sdk is not installed. Install it with `python -m pip install codebuddy-agent-sdk` or `pip install -e .[codebuddy]`.
What it means
The CodeBuddy provider is an optional integration backed by the third-party `codebuddy-agent-sdk` package. _load_sdk() imports it and, on ImportError, raises RuntimeError with install instructions because the extra wasn't installed.
Source
Thrown at deeptutor/services/llm/provider_core/codebuddy_provider.py:374
for session in sessions:
try:
await session.close()
except asyncio.CancelledError:
task = asyncio.current_task()
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
View on GitHub (pinned to 3e82f13042)
Solutions
- pip install codebuddy-agent-sdk (or pip install -e .[codebuddy] from source).
- If it should already be installed, check you're in the right virtualenv / interpreter (python -m pip install ...).
- Prevent instantiation of CodeBuddyProvider when the SDK is absent (guard on importlib.util.find_spec).
Example fix
# before
provider = CodeBuddyProvider(...)
# after
import importlib.util
if importlib.util.find_spec("codebuddy_agent_sdk") is None:
raise SystemExit("Install extra: pip install 'deeptutor[codebuddy]'")
provider = CodeBuddyProvider(...) Defensive patterns
Strategy: validation
Validate before calling
import importlib.util
if importlib.util.find_spec("codebuddy_agent_sdk") is None:
print("Run: pip install 'deeptutor[codebuddy]'") # skip/disable CodeBuddy features Type guard
def codebuddy_available() -> bool:
import importlib.util
return importlib.util.find_spec("codebuddy_agent_sdk") is not None Try / catch
try:
provider.run(...)
except RuntimeError as e:
if "not installed" in str(e):
# disable CodeBuddy path, fall back to another provider
...
raise Prevention
- Install extras explicitly in deployment: pip install 'deeptutor[codebuddy]'.
- Gate CodeBuddy features behind codebuddy_available().
- Pin extras in requirements/lockfile for Docker and CI.
When it happens
Trigger: Configuring the CodeBuddy provider (or calling fetch_codebuddy_models / _run_codebuddy) without having installed the optional dependency; installing deeptutor without the [codebuddy] extra.
Common situations: Base `pip install deeptutor` or `deeptutor-cli` which omit optional extras; a fresh venv rebuilt from a partial requirements file; CI environments that prune extras.
Related errors
- AnimationGenerator requires the optional math-animator extra
- GraphRAG is not installed. Run `pip install 'deeptutor[graph
- LightRAG is not installed. Run `pip install 'deeptutor[rag-l
- DeepTutor Web assets are not installed. Install the full app
- cron expressions need the 'croniter' package — use an 'every
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/8b1560afd2c8faf3.
Report an issue: GitHub.