Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

Added windows sandbox example

Dillon DuPontd097ad9c7b64
diff --git a/examples/winsandbox_example.py b/examples/winsandbox_example.py
new file mode 100644
index 0000000000..2f7e3f680c
--- /dev/null
+++ b/examples/winsandbox_example.py
@@ -0,0 +1,48 @@
+"""Example of using the Windows Sandbox computer provider.
+
+Learn more at: https://learn.microsoft.com/en-us/windows/security/application-security/application-isolation/windows-sandbox/
+"""
+
+import asyncio
+from computer import Computer
+
+async def main():
+ """Test the Windows Sandbox provider."""
+
+ # Create a computer instance using Windows Sandbox
+ computer = Computer(
+ provider_type="winsandbox",
+ os_type="windows",
+ memory="4GB",
+ # ephemeral=True, # Always true for Windows Sandbox
+ )
+
+ try:
+ print("Starting Windows Sandbox...")
+ await computer.run()
+
+ print("Windows Sandbox is ready!")
+ print(f"IP Address: {await computer.get_ip()}")
+
+ # Test basic functionality
+ print("Testing basic functionality...")
+ screenshot = await computer.interface.screenshot()
+ print(f"Screenshot taken: {len(screenshot)} bytes")
+
+ # Test running a command
+ print("Testing command execution...")
+ stdout, stderr = await computer.interface.run_command("echo Hello from Windows Sandbox!")
+ print(f"Command output: {stdout}")
+
+ except Exception as e:
+ print(f"Error: {e}")
+ import traceback
+ traceback.print_exc()
+
+ finally:
+ print("Stopping Windows Sandbox...")
+ await computer.stop()
+ print("Windows Sandbox stopped.")
+
+if __name__ == "__main__":
+ asyncio.run(main())