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 Browserless.

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

For code examples, see the Tool calling guide and Provider examples.

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

Action Response

data
objectRequired
error
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

Action Response

data
Required
error
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
goto_options
reject_request_pattern
reject_resource_types
url
stringRequired
wait_for_event
wait_for_selector
wait_for_timeout

Action Response

data
stringRequired
error
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
addStyleTag
bestAttempt
gotoOptions
html
options
rejectRequestPattern
rejectResourceTypes
url
waitForSelector

Action Response

data
objectRequired
error
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
url
stringRequired
waitForEvent
waitForFunction
waitForSelector
waitForTimeout

Action Response

data
arrayRequired
error
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
clip_width
clip_x
clip_y
full_page
booleanDefaults to True
image_type
stringDefaults to png
omit_background
boolean
quality
Defaults to 75
url
stringRequired

Action Response

data
objectRequired
error
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
waitForFunction
waitForSelector

Action Response

data
objectRequired
error
successful
booleanRequired