gemini-3.8-flash is the model Google recommends for it, through the Interactions API.
Google’s deprecations page lists July 28, 2026 as the shutdown date for
gemini-2.5-computer-use-preview-10-2025, with gemini-3.8-flash as its replacement. That model used the older generate_content call and the types.ComputerUse tool object. The code below uses the current Interactions API. Code that names gemini-3.7-flash keeps working: Google routes that ID to gemini-3.8-flash.Coordinate space
A Linux computer created without a template or aresolution boots at 1280x720. Some templates and Macs are 1920x1080.
Gemini does not work in pixels. It returns coordinates on a normalized 0-999 grid, scaled to the screenshot you sent. You denormalize every coordinate against the computer’s real resolution before you can click with it:
1280x720 (it came from a template, it is a Mac, you chose a resolution when you created it, or you resized its screen later), set the constants to its resolution instead. GET /computers/{id}/screens reports the current width and height, and GET /computers/{id}/screenshot?response_format=base64 returns width and height alongside the image.
Setup
Install the required packages. Gemini 3.x computer use needsgoogle-genai 2.7.0 or later. Use Orgo’s Python SDK 0.0.47 or later. Earlier versions ask for 2 GB of RAM when they create a computer, which POST /computers rejects, and their screenshot methods cannot read the stored-image path the API returns by default.
pip
.env file:
.env
terminal
Complete example
An Orgo computer is a full desktop, so declareenvironment: "desktop". The browser environment adds page-level actions such as navigate and go_back, and Google’s browser example sends the current page URL back in every result.
example.py
Usage examples
Basic tasks
Complex workflows
Key concepts
The agent loop
- Request Send the task and a screenshot to the model.
- Actions The model returns
function_callsteps. - Execute Your code runs them in order.
- Screenshot Capture the result and return one
function_resultper call. - Repeat Chain turns with
previous_interaction_iduntil no call comes back.
Reading the response
Everything the model produced for a turn is ininteraction.steps. A step of type function_call carries id, name, and arguments. Its function_result sends that id back as call_id. A step of type model_output carries content blocks, and its text blocks are the agent’s final answer.
Every action’s arguments includes an intent string explaining why the model chose it. It is the cheapest debugging signal in the loop, so log it.
System prompt
Pass the Ubuntu guidance assystem_instruction. Without it Gemini single-clicks desktop icons and nothing opens.
Send it on every call, not only the first. The Interactions API applies system_instruction and tools to one interaction only, and previous_interaction_id carries over only the conversation history:
Getting your computer ID
computer_id is the computer UUID: the id field that Create computer returns. In the dashboard, it is the last segment of the computer page’s URL, https://www.orgo.ai/computers/{id}. Pass it as Computer(computer_id="your-computer-id").
Image format conversion
Orgo’s Linux screenshots are PNG. Google’s computer use examples send PNG, and the helper decodes and re-encodes each screenshot as PNG, so the bytes always matchmime_type: "image/png", even if you ask Orgo for another format with format=jpeg or format=webp. Gemini also accepts JPEG, WebP, HEIC, and HEIF images; if you send one, set mime_type to match:
Safety confirmations
An action’sarguments can include a safety_decision from Google’s internal safety system. When its decision is require_confirmation, prompt your user before running the action, and include safety_acknowledgement in that call’s result when they approve. If they decline, do not run it. The loop above does not check safety_decision, so add this before you run it on real tasks.
enable_prompt_injection_detection is a separate, opt-in check: it scans each screenshot for hidden instructions, and Google says it blocks execution when it finds them.
Action arguments
Coordinates are normalized 0-999. Denormalizex, y, start_x, start_y, end_x, and end_y before use.
The
desktop environment also exposes mouse_down, mouse_up, key_down, and key_up for held input.
Tool compatibility
drag_and_drop maps to computer.drag(start_x, start_y, end_x, end_y) once you denormalize its four coordinates. The loop above does not handle it.
The loop takes screenshots and scrolls over HTTP rather than through the SDK, so it also runs on SDK versions before 0.0.47. Their screenshot() and screenshot_base64() cannot read the stored-image path the API returns by default, and their scroll() takes no coordinates, so the computer scrolls at the top-left corner. From 0.0.47, computer.screenshot() reads the image and computer.scroll(direction, amount, x=x, y=y) scrolls at a position.
Best practices
1. Clear instructions
2. Send a system instruction, not a user turn
3. Convert coordinates
4. Handle image format
5. Return one result per call
Everyfunction_call needs a matching function_result whose call_id is that call’s id. Attach the new screenshot to each of them.
6. Add delays
Comparison with Claude and OpenAI
Limitations
- Image format: the
mime_typeyou send must match the image bytes. Orgo’s Linux screenshots are PNG, andget_screenshot_png()re-encodes anything else as PNG. - Coordinates: normalized, so a wrong
SCREEN_WIDTHorSCREEN_HEIGHTsilently misplaces every click. - Rate limits: subject to Gemini API rate limits.
Troubleshooting
The model does not double-click desktop icons
Pass the Ubuntu system prompt assystem_instruction on every call, not only the first. Without it, single clicks only select icons.
INVALID_ARGUMENT: Unable to process input image
Gemini could not decode the image. Send bare base64 indata, with no data: prefix, and a mime_type that matches the bytes. Running the screenshot through get_screenshot_png() does both.
A key press does nothing or returns an error
The key name is not an X keysym, or its case is wrong, such asreturn for Return. Map it as keysym() does in the loop above.
Clicks land in the wrong place
SCREEN_WIDTH and SCREEN_HEIGHT do not match the computer. Check them against GET /computers/{id}/screens.
Missing API key
Ensure both environment variables are set in your.env file:
Next steps
Gemini Docs
Official Gemini computer use documentation
Orgo Quickstart
Learn more about Orgo computers
API Reference
Complete Orgo API documentation