Skip to main content
Serverless Sandbox를 사용하면 스크린샷, 마우스 클릭, 키보드 입력으로 조작할 수 있는 Linux 데스크톱을 에이전트에 제공할 수 있습니다. 이 튜토리얼에서는 일회용 서버리스 샌드박스에서 Chromium을 실행합니다. 로컬 머신의 Python 컨트롤러가 데스크톱 스크린샷을 OpenAI의 computer 도구로 보내고, 반환된 액션을 샌드박스에서 실행한 뒤 결과를 가져옵니다. Have the agent complete a sample browser form. The form’s server independently verifies the submission, so success doesn’t depend only on the model’s completion report.

Prerequisites

Before you begin, make sure you have the following:
  • Python 3.11, 3.12 또는 3.13 및 uv.
  • 샌드박스 액세스 권한이 있는 W&B API 키. 시작하기를 참조하세요.
  • gpt-5.6-sol 및 computer 도구에 대한 액세스 권한이 있는 OpenAI API 키.
  • 컨트롤러에서 샌드박스 서비스와 OpenAI API로 나가는 아웃바운드 액세스. 샌드박스는 Debian 저장소에서 패키지를 설치합니다.
The example requests 2 CPUs and 4 gibibytes (GiB) of memory, with a 30-minute maximum sandbox lifetime. It explicitly selects serverless placement, so you don’t need to deploy a runner.

Configure credentials

Create a working directory and start Bash for the hidden-input prompts:
해당 셸에서 W&B 및 OpenAI 자격 증명을 입력하세요.
Both keys stay in the local controller environment. The script doesn’t pass them to the sandbox. The controller sends desktop screenshots and the task prompt to the model API.

Create the desktop controller

In your working directory, save the following complete example as the computer_use.py file. It combines three components: Chromium runs as the desktop user with its browser sandbox enabled. The form server listens on loopback inside the sandbox. This example doesn’t create a public endpoint or open a browser on your machine. The adapter validates coordinates and key combinations and passes typed text as a literal argument. The loop stops on unsupported actions or a requested safety review. It permits up to 20 model turns and checks a 10-minute deadline between turns.
computer_use.py

Run and verify the task

From the same shell, run the controller with its dependencies:
The controller creates a sandbox, installs the desktop packages, and waits for Chromium to load the form. The model then reads the page, enters the displayed phrase, and selects Verify. Package installation can take several minutes. The number of model turns can vary. Each run saves its results in a new directory under computer-use-results/: After a successful run, the result.json file contains "status": "passed", "verified": true, and "cleanup": "stopped". To see PASS on the form, open the agent/final.png file. The controller checks the form server’s verification file before declaring success. The controller attempts to stop the sandbox in a finally block, including when the task fails. If cleanup reports "failed" or you terminate the controller before cleanup finishes, use the ID from the sandbox-id.txt file to stop it. Replace [SANDBOX-ID] with that ID. In the same shell, stop the sandbox:
If the task fails, inspect the saved transcript and the latest agent/turn-*.png file if available. API, desktop installation, and browser startup failures can occur before one or both files exist. For sandbox connection and execution errors, see Sandboxes support articles.

Next steps

To adapt the example, replace the sample form and task with an application you control. Keep the screenshot/action loop and add an application-specific success check. For repeated runs, build the desktop packages into a container image to avoid installing them at startup. See Sandbox configuration. Before you use the agent with other applications, define allowed destinations and actions, and require human approval for sensitive operations. The sample prompt and input validation don’t enforce where Chromium can navigate. When you extend the controller, review OpenAI’s computer-use guidance. For more ways to connect an agent to a sandbox, see Agents. For lifecycle management, see Cleanup patterns.
마지막 수정일 2026년 10월 5일