Skip to main content

enterprise_ai.packs.tools

Source: sdks/python/src/enterprise_ai/packs/tools.py. Back to the Python SDK reference index.

note

This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.

Class ToolMissing​

A required external binary is not installed.

RuntimeError

Functions​

toolchain_dir​

toolchain_dir() -> Path

Directory of the downloaded pack toolchain: EAI_TOOLCHAIN_DIR, default /tmp/toolchains.

This element takes no parameter.

Returns: Path. Path of the toolchain directory.

find_tool​

find_tool(name: str) -> str

Path of an external tool of the pack toolchain: EAI_<NAME>_BIN, then $EAI_TOOLCHAIN_DIR/<name>, then PATH.

NameTypeDefaultRequiredDescription
namestryesName of the binary, such as cosign, oras, trivy, opa, fga or zot.

Returns: str. Path of the executable; raises ToolMissing when it is found nowhere.

Raises: ToolMissing.

pack_python​

pack_python() -> str

Interpreter running the pack code (MCP SDK, pytest): EAI_PACK_PYTHON or the venv of packs/bootstrap.sh.

This element takes no parameter.

Returns: str. Path of the interpreter: EAI_PACK_PYTHON, or else <toolchain_dir>/packs-venv/bin/python; raises ToolMissing when the file does not exist.

Raises: ToolMissing.

run​

run(command: list[str], cwd: str | Path | None = None, env: dict[str, str] | None = None, timeout: int = 600, check: bool = True, stdin: str | None = None) -> subprocess.CompletedProcess

Argument list, never a shell; stdout and stderr captured as text.

NameTypeDefaultRequiredDescription
commandlist[str]yesProgram and its arguments, run without a shell.
cwdstr | Path | NoneNonenoWorking directory of the process; the current one when omitted.
envdict[str, str] | NoneNonenoEnvironment of the process; the current environment when omitted.
timeoutint600noMaximum duration in seconds (default 600).
checkboolTruenoRaise RuntimeError with the end of the output when the exit code is not 0 (default True).
stdinstr | NoneNonenoText written to the standard input of the process.

Returns: subprocess.CompletedProcess. subprocess.CompletedProcess with returncode, stdout and stderr as text.

Raises: RuntimeError.