> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.multion.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.multion.ai/_mcp/server.

# Order on Amazon with MultiOn

> Learn to use browse and local mode to take actions autonomously

This example combines MultiOn [browse](/autonomous-api/browse) and [local mode](/learn/sessions#local-mode) to purchase a book on Amazon.

## Project setup

#### TypeScript

### Install extension

Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).

### Initialize project

Create a new project by running the following command in your terminal:

```bash
npm init
```

### Install package

Install the `multion` package by running the following command in your terminal:

```bash
npm install multion
```

### Import library

Create a new file called `index.ts` and import the required library for the example:

```ts
import { MultiOnClient } from 'multion';
```

### Initialize client

Initialize the MultiOn client with your API key.

```ts
const multion = new MultiOnClient({ apiKey: "YOUR_API_KEY" });
```

### Run script

Run your script by running the following command in your terminal:

```bash
node index.ts
```

#### Python

### Install extension

Find the [MultiOn Browser Extension](https://chrome.google.com/webstore/detail/multi%C2%B7on/ddmjhdbknfidiopmbaceghhhbgbpenmm) on the Chrome Web Store and click **"Add to Chrome"** to add it to your browser. Make sure the **API Enabled** option is checked. Learn more about the browser extension [here](/learn/browser-extension).

### Install package

Install the `multion` package by running the following command in your terminal:

```bash
pip install multion
```

### Import library

Create a new file called `main.py` and import the required library for the example:

```python
from multion.client import MultiOn
```

### Initialize client

Initialize the MultiOn client with your API key.

```python
client = MultiOn(api_key="YOUR_API_KEY")
```

### Run script

Run your script by running the following command in your terminal:

```bash
python main.py
```

## Add book to cart

Use [browse](/autonomous-api/browse) in local mode to add the book to your shopping cart.

#### TypeScript

```ts
const cartResponse = await multion.browse({
  cmd: "Add the Three Body Problem book to my cart",
  url: "https://amazon.com",
  local: true
});

console.log(cartResponse.message);
```

#### Python

```python
cart_response = client.browse(
    cmd="Add the Three Body Problem book to my cart",
    url="https://amazon.com",
    local=True,
)

print(cart_response.message)
```

## Buy the book!

Now, if you want to buy the book, continue the same session to complete the purchase.

#### TypeScript

```ts
const sessionId = followResponse.sessionId

const purchaseResponse = await multion.browse({
  sessionId: sessionId,
  cmd: "Check out and purchase the book"
});

console.log(purchaseResponse.message);
```

#### Python

```python
session_id = follow_response.session_id

purchase_response = client.browse(
    session_id=session_id,
    cmd="Check out and purchase the book",
)

print(purchase_response.message)
```