To use Hyperbrowser with your code, you will need an API Key. You can get one easily from the . Once you have your API Key, add it to your .env file as HYPERBROWSER_API_KEY .
3
Execute a Task
Next, you can have Hyperbrowser execute a task using OpenAI's Computer-Using Agent by simply providing a task.
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.cua.startAndWait({
task: "What is the top post on Hacker News?",
});
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 StartBrowserUseTaskParams
from dotenv import load_dotenv
load_dotenv()
hb_client = Hyperbrowser(api_key=os.getenv("HYPERBROWSER_API_KEY"))
def main():
resp = hb_client.agents.cua.start_and_wait(
StartBrowserUseTaskParams(
task="What is the top post on Hacker News?"
)
)
print(f"Output:\n\n{resp.data.final_result}")
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"Error: {e}")
4
View Session in Dashboard
You can view all your sessions in the and see their recordings or other key metrics like logs. To see a live view of what the agent is doing, you can see your sessions on the page and click on View Live URL.
More information about sessions, including user profiles, web recordings, live view, and more can be found in the