MCPcopy
hub / github.com/langchain-ai/deepagents / _install_extra

Method _install_extra

libs/code/deepagents_code/app.py:4923–5143  ·  view source on GitHub ↗

Install a `deepagents-code` extra, mounting progress and restart offer. Shared by the `/install ` command and the model selector's install-on-select flow. Mounts its own status/error messages and offers a one-keypress restart for restart-capable extras. Args:

(
        self, extra: str, *, force: bool = False, auto_restart: bool = False
    )

Source from the content-addressed store, hash-verified

4921 await self._install_extra(extra, force=force)
4922
4923 async def _install_extra(
4924 self, extra: str, *, force: bool = False, auto_restart: bool = False
4925 ) -> bool:
4926 """Install a `deepagents-code` extra, mounting progress and restart offer.
4927
4928 Shared by the `/install <extra>` command and the model selector&#x27;s
4929 install-on-select flow. Mounts its own status/error messages and offers
4930 a one-keypress restart for restart-capable extras.
4931
4932 Args:
4933 extra: The extra name to install (e.g. `"baseten"`, `"daytona"`).
4934 force: Skip the "unknown extra" guard for valid-but-unlisted names.
4935 auto_restart: Restart the app-owned server immediately after a
4936 restart-capable install. Used only when the user selected a model
4937 that cannot load until the server respawns.
4938
4939 Returns:
4940 `True` when the extra installed successfully and, when `auto_restart`
4941 was requested, the server was restarted (or a fresh startup will
4942 load it); `False` otherwise. The interactive restart offer
4943 (non-`auto_restart` path) does not affect the return value.
4944 """
4945 try:
4946 from deepagents_code.config import _is_editable_install
4947 from deepagents_code.extras_info import (
4948 KNOWN_EXTRAS,
4949 MODEL_PROVIDER_EXTRAS,
4950 SANDBOX_EXTRAS,
4951 ExtrasIntrospectionError,
4952 )
4953 from deepagents_code.update_check import (
4954 ToolRequirementIntrospectionError,
4955 create_update_log_path,
4956 editable_extra_hint,
4957 install_extra_command,
4958 install_extra_recovery_command,
4959 is_valid_extra_name,
4960 perform_install_extra,
4961 )
4962 except ImportError as exc:
4963 logger.warning("/install command import failed", exc_info=True)
4964 await self._mount_message(
4965 ErrorMessage(f"Install failed: {type(exc).__name__}: {exc}"),
4966 )
4967 return False
4968
4969 if not is_valid_extra_name(extra):
4970 await self._mount_message(
4971 AppMessage(
4972 "Invalid extra name. Extra names must be "
4973 "alphanumeric with `-`, `_`, or `.` (PEP 508).",
4974 ),
4975 )
4976 return False
4977
4978 if await asyncio.to_thread(_is_editable_install):
4979 await self._mount_message(
4980 AppMessage(

Calls 12

_mount_messageMethod · 0.95
ErrorMessageClass · 0.90
is_valid_extra_nameFunction · 0.90
AppMessageClass · 0.90
editable_extra_hintFunction · 0.90
create_update_log_pathFunction · 0.90
perform_install_extraFunction · 0.90