---
title: "Browser extensions"
description: "Augment your browser sessions with your own Chrome extensions."
image: "https://help.agent.mq/og.svg"
---

> Documentation Index
> Fetch the complete documentation index at: https://help.agent.mq/llms.txt
> Use this file to discover all available pages before exploring further.

# Browser extensions

You can load your own Chrome extensions into Browsers sessions.

## Sample extension

Here's a simple example extension that modifies page titles. It consists of two files:

```js manifest.json
  {
  "manifest_version": 3,
  "version": "1.0",
  "name": "My Test Extension",
  "description": "Test of a simple browser extension",
  "content_scripts": [
      {
          "matches": [
              "https://www.sfmoma.org/*"
          ],
          "js": [
              "content-script.js"
          ]
      }
  ]
  }
```

```js content-script.js
  document.title += " -- Title updated by browser extension";
```

> **Note**
>
> You can download this sample extension
> [here](http://browser-tests-alpha.vercel.app/demo-extension.zip). The
> extension must be in a `.zip` file format with a `manifest.json` at the root.
> The file must be less than or equal to 100 MB.

## Upload your extension

Once you have your extension files zipped up, you can upload it using the SDK:

### Node.js

```javascript
import { Browsers } from '@agentmq/browsers';
import fs from 'fs';

const browsers = new Browsers({ apiKey: process.env.AGENTMQ_TOKEN });

const file = fs.createReadStream('extension.zip');
const extension = await browsers.extensions.create({ file });

const extensionId = extension.id;
console.log(`Extension uploaded with ID: ${extensionId}`);
```

### Python

```python
from agentmq.browsers import Browsers
import os

browsers = Browsers(api_key=os.environ["AGENTMQ_TOKEN"])

with open("extension.zip", "rb") as f:
    extension = browsers.extensions.create(file=f)

extension_id = extension.id
print(f"Extension uploaded with ID: {extension_id}")
```

## Create a session with your extension

To use your extension, create a new session with the extension enabled:

### Node.js

```javascript
import { Browsers } from '@agentmq/browsers';

const browsers = new Browsers({ apiKey: process.env.AGENTMQ_TOKEN });

const session = await browsers.sessions.create({
    extensionId: 'your-extension-id'
});

console.log(`Session created with ID: ${session.id}`);
```

### Python

```python
from agentmq.browsers import Browsers
import os

browsers = Browsers(api_key=os.environ["AGENTMQ_TOKEN"])

session = browsers.sessions.create(
    extension_id="your-extension-id"
)

print(f"Session created with ID: {session.id}")
```

> **Note**
>
> Starting a new session with an extension can increase the session creation
> time. The browser must be restarted to load the extension, which itself has
> nonzero load time.

## Verify the extension

To verify your extension is working:

1. Connect to your session using Playwright or Selenium
2. Navigate to a page where your extension should be active
3. Check for the expected modifications or behaviors

For the sample extension above, navigate to [https://www.sfmoma.org](https://www.sfmoma.org) and verify that the page title has been modified with the additional text.

Source: https://help.agent.mq/browsers/core-features/browser-extensions/index.mdx
