LocalRuntime(dir=None, cleanup=False, timeout=60, max_output=100000, blocked=list(), extra_paths=None)
Local filesystem storage and subprocess execution.
| PARAMETER | DESCRIPTION |
dir | Directory where skills are installed. None → .agents/skills (default). TYPE: str | Path | None DEFAULT: None |
cleanup | If True, the install directory is deleted at process exit. TYPE: bool DEFAULT: False |
timeout | Per-command timeout in seconds. Defaults to 60. TYPE: float DEFAULT: 60 |
max_output | Maximum characters returned from a script run. Defaults to 100,000. TYPE: int DEFAULT: 100000 |
blocked | Command prefixes that are not allowed to run. Empty list → nothing blocked. TYPE: list[str] DEFAULT: list() |
extra_paths | Additional read-only directories to scan for skills. Installed skills always go to dir; these paths are only used for discovery. TYPE: Sequence[str | Path] | None DEFAULT: None |
Example::
# Default — installs to .agents/skills
LocalRuntime()
# Custom install directory
LocalRuntime("./my-skills")
# Full control
LocalRuntime("./my-skills", timeout=30, cleanup=True, blocked=["rm -rf"])
# Extra read-only search paths
LocalRuntime("./my-skills", extra_paths=["./shared-skills"])
Resolved install directory.
Source code in autogen/beta/tools/runtime/local.py
| def discover(self) -> list[SkillMetadata]:
return self._loader.discover()
|
Source code in autogen/beta/tools/runtime/local.py
| def load(self, name: str) -> str:
return self._loader.load(name)
|
Source code in autogen/beta/tools/runtime/local.py
| def get_path(self, name: str) -> Path:
return self._loader.get_path(name)
|
Source code in autogen/beta/tools/runtime/local.py
| def invalidate(self) -> None:
self._loader.invalidate()
|
Source code in autogen/beta/tools/runtime/local.py
| def ensure_storage(self) -> None:
self._install_dir.mkdir(parents=True, exist_ok=True)
|
Source code in autogen/beta/tools/runtime/local.py
| def install(self, source: Path, name: str) -> None:
dest = self._install_dir / name
if dest.exists():
shutil.rmtree(dest)
shutil.copytree(source, dest)
|
Source code in autogen/beta/tools/runtime/local.py
| def remove(self, name: str) -> None:
target = (self._install_dir / name).resolve()
if not target.is_relative_to(self._install_dir.resolve()):
raise ValueError(f"Cannot remove '{name}': path traversal detected")
if not target.exists():
raise FileNotFoundError(f"Cannot remove '{name}': skill not found in {self._install_dir}")
shutil.rmtree(target)
|
Source code in autogen/beta/tools/runtime/local.py
| def shell(self, scripts_dir: Path) -> ShellEnvironment:
return LocalShellEnvironment(
path=scripts_dir,
cleanup=False,
timeout=self.timeout,
max_output=self.max_output,
blocked=self.blocked or None,
)
|