Browserless

Learn how to use Browserless with Composio

Overview

SLUG: BROWSERLESS

Description

Browserless is a service that provides headless browser automation, allowing users to run automations on their own sites with browser infrastructure.

Authentication Details

token
stringRequired

Connecting to Browserless

Create an auth config

Use the dashboard to create an auth config for the Browserless toolkit. This allows you to connect multiple Browserless accounts to Composio for agents to use.

1

Select App

Navigate to the Browserless toolkit page and click “Setup Integration”.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Integration”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using Bearer Token

1from composio import Composio
2from composio.types import auth_scheme
3
4# Auth config ID created above
5browserless_auth_config_id = "ac_YOUR_BROWSERLESS_CONFIG_ID"
6
7# UUID from database/application
8user_id = "0000-0000-0000"
9
10composio = Composio()
11
12
13def authenticate_toolkit(user_id: str, auth_config_id: str):
14 # Replace this with a method to retrieve the Bearer Token from the user.
15 bearer_token = input("[!] Enter bearer token")
16 connection_request = composio.connected_accounts.initiate(
17 user_id=user_id,
18 auth_config_id=auth_config_id,
19 config={"auth_scheme": "BEARER_TOKEN", "val": bearer_token}
20 )
21 print(f"Successfully connected Browserless for user {user_id}")
22 print(f"Connection status: {connection_request.status}")
23
24 return connection_request.id
25
26
27connection_id = authenticate_toolkit(user_id, browserless_auth_config_id)
28
29# You can verify the connection using:
30connected_account = composio.connected_accounts.get(connection_id)
31print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Browserless toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["BROWSERLESS"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: Download file using Puppeteer script

Description

This tool allows downloading files that chrome has downloaded during the execution of puppeteer code. it sets up a blank page, creates a fresh download directory, injects the provided code, and executes it. once the script finishes, any downloaded files from chromium are returned with the appropriate content-type header.

Action Parameters

code
stringRequired
context
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Execute Custom Function

Description

A tool that allows executing custom puppeteer scripts via http requests. this endpoint enables users to run browser automation tasks without managing their own infrastructure.

Action Parameters

code
stringRequired
context
object

Action Response

data
objectRequired
error
string
successful
booleanRequired
type
stringRequired

Tool Name: Fetch HTML Content

Description

This tool fetches the complete html content of a webpage using browserless's content api. it's designed to retrieve the full html contents of any website, including dynamically generated content.

Action Parameters

best_attempt
boolean
goto_options
object
reject_request_pattern
array
reject_resource_types
array
url
stringRequired
wait_for_event
object
wait_for_selector
object
wait_for_timeout
integer

Action Response

data
stringRequired
error
string
successful
booleanRequired

Tool Name: Generate PDF from webpage

Description

This tool generates a pdf from a specified webpage using browserless's pdf generation api. it allows specifying the url of the webpage along with parameters such as format, filename, and waituntil options to control the pdf generation process.

Action Parameters

addScriptTag
array
addStyleTag
array
bestAttempt
boolean
gotoOptions
object
html
string
options
object
rejectRequestPattern
array
rejectResourceTypes
array
url
string
waitForSelector
object

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Scrape webpage content using CSS selectors

Description

A tool to extract structured content from a webpage by specifying css selectors. the tool navigates to the specified url, waits for the page to load (including parsing and executing javascript), and returns the selected elements in a structured json format.

Action Parameters

elements
arrayRequired
gotoOptions
object
url
stringRequired
waitForEvent
object
waitForFunction
object
waitForSelector
object
waitForTimeout
integer

Action Response

data
arrayRequired
error
string
successful
booleanRequired

Tool Name: Take Screenshot

Description

A tool that captures a screenshot of a webpage using browserless's screenshot api. the tool takes a url and returns either a png or jpeg image. it includes options for full page capture, image type, quality, and clipping coordinates.

Action Parameters

clip_height
integer
clip_width
integer
clip_x
integer
clip_y
integer
full_page
booleanDefaults to True
image_type
stringDefaults to png
omit_background
boolean
quality
integerDefaults to 75
url
stringRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Unblock Protected Content

Description

This tool provides access to content from websites that implement bot protection mechanisms. it is designed to bypass various types of protection (such as captcha and bot detections) and return the html content of the protected webpage, with optional customization through parameters like waitfor, timeout, and stealth mode.

Action Parameters

browserWSEndpoint
boolean
content
booleanDefaults to True
cookies
boolean
screenshot
boolean
ttl
integerDefaults to 30000
url
stringRequired
waitForEvent
object
waitForFunction
object
waitForSelector
object

Action Response

data
objectRequired
error
string
successful
booleanRequired