LocalEnvironment
autogen.beta.tools.sandbox.environment.LocalEnvironment #
LocalEnvironment(path=None, *, cleanup=None, timeout=60, max_output=100000, env_vars=None, languages=('python', 'bash'))
Bases: SingletonFactory
Local-subprocess backend — the default environment for :class:~autogen.beta.tools.SandboxShellTool.
A :class:~autogen.beta.tools.sandbox.SandboxFactory over a single :class:LocalSandbox with a fixed working directory. Hand it to a tool the same way you would a :class:DockerEnvironment / :class:DaytonaEnvironment::
shell = SandboxShellTool(LocalEnvironment("/tmp/proj"), allowed=["git"])
Commands run via subprocess on the host, so there is no real isolation — that is why :class:SandboxShellTool (which filters commands) defaults to it, but :class:SandboxCodeTool (which runs arbitrary model-written code) does not and requires an explicit backend.
| PARAMETER | DESCRIPTION |
|---|---|
path | Working directory. |
cleanup | Delete TYPE: |
timeout | Default per-command timeout in seconds. TYPE: |
max_output | Maximum characters in a single command's output. TYPE: |
env_vars | Environment variables merged into every command. |
languages | Informational language list for the sandbox. TYPE: |
Source code in autogen/beta/tools/sandbox/environment.py
aclose async #
Close the underlying :class:LocalSandbox (deletes its workdir when cleanup was set). Safe to call multiple times.