WindowsSandbox#

Run commands and agent-written programs inside an operating-system boundary. See the guide.

class zett_agent.sandbox.windows.WindowsSandbox(policy=None, *, memory_strategy=MemoryStrategy.AUTO)[源代码]#

Run commands on Windows behind the sandbox interface, without isolation.

Windows has no counterpart of Seatbelt or bubblewrap that this package drives, so the policy's paths and network setting are not enforced: the process can read and write whatever the user can and can use the network. What it still gives is everything the Sandbox interface promises around the process: the filtered environment, the time limit, the output cap, and stopping the whole process tree. A host's code is then the same on every platform, and isolated tells the truth about the boundary.

create_sandbox() returns it on Windows and warns when it does; require_isolation=True turns that into an error.

示例

Run with no isolation, deliberately:

sandbox = WindowsSandbox()
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.

参数:
name: ClassVar[str] = 'windows'#

Short stable name of the backend, reported in results.