PassthroughSandbox#
Run commands and agent-written programs inside an operating-system boundary. See the guide.
- class zett_agent.sandbox.passthrough.PassthroughSandbox(policy=None, *, memory_strategy=MemoryStrategy.AUTO)[源代码]#
Run commands with no isolation, behind the same interface as a real sandbox.
The policy is not enforced: the process can read and write whatever the user can and can use the network. What it still gives is everything the
Sandboxinterface promises around the process: the filtered environment, the time limit, the output cap, and stopping the whole process tree. That keeps a host's code identical on every platform, withisolatedtelling the truth about the boundary.It is what
create_sandbox()returns on a platform with no backend, which is Windows today, and it warns when it does. It is never chosen in place of a backend that exists but cannot run.示例
Run with no isolation, deliberately:
sandbox = PassthroughSandbox() result = await sandbox.run("echo hello") assert not result.isolated
警告
This is not a sandbox. A command run through it has the full authority of the host process.
- 参数:
policy (SandboxPolicy | None)
memory_strategy (MemoryStrategy | str)
- name: ClassVar[str] = 'passthrough'#
Short stable name of the backend, reported in results.
- isolated: ClassVar[bool] = False#
Whether this backend enforces a boundary. False only for the backend that runs commands as they are.