> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firecrawl.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# ブラウザサンドボックス

> エージェントが Web とやり取りできる安全なブラウザサンドボックス。

<Info>
  エージェントワークフローには [Interact](/ja/features/interact) を使用してください。Interact はサポート対象の CLI/MCP パスであり、スクレイピング後にプロンプトまたはコードで操作できます。MCP では URL から直接開くこともサポートしています。
</Info>

| 対象          | 用途                                                                                | エントリーポイント                                                                                   | エージェント向けインターフェース                        |
| ----------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------- |
| ブラウザサンドボックス | サンドボックス、CDP URL、ライブビュー、または永続的なセッションライフサイクルを必要とする API/SDK ユーザー向けのスタンドアロンのブラウザセッション | `POST /v2/interact`                                                                         | API と SDKs。非表示の CLI browser コマンドはレガシーです |
| Interact    | スクレイピングしたページ上での操作。MCP は `firecrawl_interact` の URL モードで URL から開くこともできます           | `POST /v2/scrape/{scrapeId}/interact`、スクレイピング後の CLI `interact`、または MCP `firecrawl_interact` | CLI/MCP のエージェントワークフローに推奨                |

Firecrawl ブラウザサンドボックス は、API および SDK のユーザーに、エージェントが Web とやり取りできる安全なブラウザ環境を提供します。フォームへの入力、ボタンのクリック、認証などを実行できます。
ローカルでのセットアップは不要で、Chromium のインストールやドライバーの互換性の問題もありません。agent browser と playwright はプリインストール済みです。

[API](/ja/api-reference/endpoint/browser-create)、[Node SDK](/ja/sdks/node#browser)、[Python SDK](/ja/sdks/python#browser)、および [Vercel AI SDK](/ja/developer-guides/llm-sdks-and-frameworks/vercel-ai-sdk) 経由で利用できます。非表示の `firecrawl browser` CLI コマンドはレガシーです。CLI と MCP のエージェントフローでは、代わりに scrape + interact を使用してください。

AI コーディングエージェント (Claude Code、Codex、Open Code、Cursor など) に Interact 対応を追加するには、Firecrawl スキルをインストールします。

```bash theme={null}
npx -y firecrawl-cli@latest init --all --browser
```

各セッションは、インフラを管理することなくスケールする、分離された使い捨てまたは永続的なサンドボックス内で実行されます。

<div id="quick-start">
  ## クイックスタート
</div>

セッションを作成し、コードを実行して終了します。

<CodeGroup>
  ```js Node theme={null}
  // npm install firecrawl
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  // 1. Launch a session
  const session = await firecrawl.browser();
  console.log(session.cdpUrl); // wss://cdp-proxy.firecrawl.dev/cdp/...

  // 2. Execute code
  const result = await firecrawl.browserExecute(session.id, {
    code: `
      await page.goto("https://news.ycombinator.com");
      const title = await page.title();
      console.log(title);
    `,
    language: "node",
  });
  console.log(result.result); // "Hacker News"

  // 3. Close
  await firecrawl.deleteBrowser(session.id);
  ```

  ```python Python theme={null}
  # pip install firecrawl
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  # 1. セッションを起動
  session = app.browser()
  print(session.cdp_url)  # wss://cdp-proxy.firecrawl.dev/cdp/...

  # 2. Execute code
  result = app.browser_execute(
      session.id,
      code='await page.goto("https://news.ycombinator.com")\ntitle = await page.title()\nprint(title)',
      language="python",
  )
  print(result.result)  # "Hacker News"

  # 3. Close
  app.delete_browser(session.id)
  ```

  ```bash CLI theme={null}
  # Install the Firecrawl CLI
  npm install -g firecrawl-cli

  # 省略形 - セッションを自動起動、"execute"不要
  firecrawl browser "open https://news.ycombinator.com"
  firecrawl browser "snapshot"
  firecrawl browser "scrape"

  # Close when done
  firecrawl browser close
  ```

  ```bash cURL theme={null}
  # 1. セッションを起動
  curl -X POST "https://api.firecrawl.dev/v2/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json"

  # 2. Execute code
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "code": "await page.goto(\"https://news.ycombinator.com\")\ntitle = await page.title()\nprint(title)"
    }'

  # 3. Close
  curl -X DELETE "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"
  ```
</CodeGroup>

* **ドライバーのインストール不要** - Chromium バイナリ不要、`playwright install` 不要、ドライバー互換性の問題なし
* **Python、JavaScript、Bash 対応** - API、CLI、または SDK 経由でコードを送信して結果を取得。3 つの言語すべてがサンドボックス環境上でリモート実行されます
* **agent-browser** - 60 以上のコマンドがプリインストール済みの CLI。AI エージェントは Playwright コードではなくシンプルな bash コマンドを書くことで操作できます
* **Playwright ロード済み** - サンドボックス環境には Playwright がプリインストール済み。必要であればエージェントは Playwright コードを記述することもできます
* **CDP へのアクセス** - 完全な制御が必要なときは、独自の Playwright インスタンスを WebSocket 経由で接続可能
* **ライブビュー** - 埋め込み可能なストリーム URL を使って、セッションをリアルタイムで監視可能
* **インタラクティブ ライブビュー** - 埋め込み可能なインタラクティブなストリームを通じて、ユーザーがブラウザを直接操作できるようにします

<div id="launch-a-session">
  ## セッションを開始する
</div>

セッションID、CDP URL、ライブビューのURLを返します。

<CodeGroup>
  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  const session = await firecrawl.browser({
    ttl: 120,
    activityTtl: 60,
  });

  console.log(session.id);
  console.log(session.cdpUrl);      // wss://cdp-proxy.firecrawl.dev/cdp/...
  console.log(session.liveViewUrl); // https://liveview.firecrawl.dev/...
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  session = app.browser(
      ttl=120,
      activity_ttl=60,
  )

  print(session.id)
  print(session.cdp_url)        # wss://cdp-proxy.firecrawl.dev/cdp/...
  print(session.live_view_url)  # https://liveview.firecrawl.dev/...
  ```

  ```bash CLI theme={null}
  # ライブビューとカスタムTTLで起動
  firecrawl browser launch-session --stream --ttl 120 --ttl-inactivity 60

  # 起動してセッション情報をファイルに保存
  firecrawl browser launch-session -o session.json --json
  ```

  ```bash cURL theme={null}
  curl -X POST "https://api.firecrawl.dev/v2/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "ttl": 120,
      "activityTtl": 60
    }'
  ```
</CodeGroup>

```json Response theme={null}
{
  "success": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "cdpUrl": "wss://browser.firecrawl.dev/cdp/550e8400...?token=abc123...",
  "liveViewUrl": "https://liveview.firecrawl.dev/...",
  "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
  "expiresAt": "2025-01-15T10:40:00Z"
}
```

<div id="execute-code">
  ## コードの実行
</div>

セッション内で Python、JavaScript、または bash のコードを実行します。Output は `stdout` 経由で返されます。Node.js では、最後の式の値も `result` として利用できます。

<CodeGroup>
  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  const result = await firecrawl.browserExecute("YOUR_SESSION_ID", {
    code: 'await page.goto("https://example.com"); const title = await page.title(); console.log(title);',
    language: "node",
  });

  console.log(result);
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  result = app.browser_execute(
      "YOUR_SESSION_ID",
      code='await page.goto("https://example.com")\ntitle = await page.title()\nprint(title)',
      language="python",
  )

  print(result)
  ```

  ```bash CLI theme={null}
  # agent-browserコマンド (デフォルト - "agent-browser"が自動的にプレフィックスとして付与されます)
  firecrawl browser execute "open https://example.com"
  firecrawl browser execute "snapshot"
  firecrawl browser execute "scrape"

  # Execute Playwright Python code
  firecrawl browser execute --python 'await page.goto("https://example.com")
  print(await page.title())'

  # Execute Playwright JavaScript code
  firecrawl browser execute --node 'await page.goto("https://example.com"); document.title'

  # Execute arbitrary bash in the sandbox
  firecrawl browser execute --bash 'ls /tmp'

  # Target a specific session
  firecrawl browser execute --session <id> "snapshot"
  ```

  ```bash cURL theme={null}
  # Execute Playwright Python code
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "code": "await page.goto(\"https://example.com\")\ntitle = await page.title()\nprint(title)",
      "language": "python"
    }'

  # Playwright JavaScriptコードを実行
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "code": "await page.goto(\"https://example.com\"); const title = await page.title(); console.log(title);",
      "language": "node"
    }'
  ```

  ```bash cURL (Bash / agent-browser) theme={null}
  # Navigate to a page
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "code": "agent-browser open https://example.com", "language": "bash" }'

  # @ref IDを含むアクセシビリティスナップショットを取得
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "code": "agent-browser snapshot", "language": "bash" }'

  # Interact using @ref IDs from the snapshot
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "code": "agent-browser click @e5", "language": "bash" }'

  # Extract page content as markdown
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "code": "agent-browser scrape", "language": "bash" }'
  ```
</CodeGroup>

```json Response theme={null}
{
  "success": true,
  "stdout": "",
  "result": "Example Domain",
  "stderr": "",
  "exitCode": 0,
  "killed": false
}
```

<div id="handling-file-downloads">
  ### ファイルダウンロードの処理
</div>

セッション内でダウンロードされたファイルはキャプチャして、base64 として返すことができます。execute エンドポイントから Playwright の download API を使用します。

<CodeGroup>
  ```python Python theme={null}
  import base64

  async with page.expect_download() as download_info:
      await page.click('a#download-link')  # ダウンロードをトリガーする要素をクリック

  download = download_info.value
  path = await download.path()

  # 必要に応じて既知のパスに保存
  # await download.save_as('/tmp/myfile.pdf')

  # ファイル内容を読み取り、base64 として出力
  with open(path, "rb") as f:
      content = base64.b64encode(f.read()).decode()
      print(content)
  ```

  ```javascript Node theme={null}
  // リンク要素からダウンロード URL を取得
  const href = await page.getAttribute('a#download-link', 'href');

  // ブラウザーコンテキストでファイルを取得し、base64 に変換
  const b64 = await page.evaluate(async (url) => {
    const resp = await fetch(url);
    const blob = await resp.blob();
    return new Promise((resolve) => {
      const reader = new FileReader();
      reader.onloadend = () => resolve(reader.result.split(',')[1]);
      reader.readAsDataURL(blob);
    });
  }, href);

  process.stdout.write(b64);
  ```
</CodeGroup>

<Note>
  サンドボックスのファイルシステムは一時的なものです。ダウンロードしたファイルはセッションの終了時に失われます。ファイルを永続化するには、セッション内で内容を読み取り、独自のストレージに保存してください。永続プロファイルではブラウザーの状態 (cookie、localStorage) は保持されますが、ディスク上のファイルは保持されません。
</Note>

<div id="agent-browser-bash-mode">
  ## agent-browser (Bash モード)
</div>

[agent-browser](https://github.com/vercel-labs/agent-browser) は、すべてのサンドボックスにプリインストールされているヘッドレスブラウザ CLI です。Playwright のコードを書く代わりに、エージェントはシンプルな bash コマンドを送信します。CLI は自動的に `--cdp` フラグを付与し、agent-browser がアクティブなセッションに自動で接続できるようにします。

<Note>
  以下の `firecrawl browser` CLI の例は、レガシーなブラウザサンドボックス セッション向けです。CLI/MCP のエージェント ワークフローでは、`firecrawl interact` または MCP の `firecrawl_interact` ツールを優先して使用してください。
</Note>

<div id="shorthand">
  ### 省略記法
</div>

`browser` コマンドを使う最速の方法です。省略記法も `execute` も、どちらも自動的に agent-browser にコマンドを送信します。省略記法は単に `execute` を省略し、必要に応じてセッションを自動的に開始します。

```bash theme={null}
firecrawl browser "open https://example.com"
firecrawl browser "snapshot"
firecrawl browser "click @e5"
```

<div id="cli">
  ### CLI
</div>

明示的な形では `execute` を使用します。コマンドは自動的に agent-browser に送信されるので、`agent-browser` と入力したり、`--bash` を付けたりする必要はありません。

<CodeGroup>
  ```bash ナビゲーション & スナップショット theme={null}
  firecrawl browser execute "open https://example.com"
  firecrawl browser execute "snapshot"
  ```

  ```bash 操作 theme={null}
  firecrawl browser execute "click @e5"
  firecrawl browser execute "fill @e3 'search query'"
  firecrawl browser execute "scrape"
  ```
</CodeGroup>

<div id="api-sdk">
  ### API と SDK
</div>

API または SDK を使って agent-browser コマンドを実行するには、`language: "bash"` を指定します：

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID/execute" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "code": "agent-browser snapshot",
      "language": "bash"
    }'
  ```

  ```javascript Node theme={null}
  const result = await app.browserExecute(sessionId, {
    code: "agent-browser snapshot",
    language: "bash",
  });
  ```

  ```python Python theme={null}
  result = app.browser_execute(
      session_id,
      code="agent-browser snapshot",
      language="bash",
  )
  ```
</CodeGroup>

<div id="session-management">
  ## セッション管理
</div>

<div id="persistent-sessions">
  ### 永続セッション
</div>

デフォルトでは、各ブラウザセッションは常にまっさらな状態から始まります。`profile` を使うと、セッション間でブラウザの状態を保存し再利用できます。ログイン状態の維持や設定の保持に役立ちます。

プロファイルを保存または選択するには、セッション作成時に `profile` パラメータを使用します。

<CodeGroup>
  ```js Node theme={null}
  const session = await firecrawl.browser({
    ttl: 600,
    profile: {
      name: "my-profile",
      saveChanges: true,
    },
  });
  ```

  ```python Python theme={null}
  session = app.browser(
      ttl=600,
      profile={
          "name": "my-profile",
          "save_changes": True,
      },
  )
  ```

  ```bash cURL theme={null}
  curl -X POST "https://api.firecrawl.dev/v2/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "ttl": 600,
      "profile": {
        "name": "my-profile",
        "saveChanges": true
      }
    }'
  ```

  ```bash CLI theme={null}
  # プロファイルで起動する（デフォルトで変更を保存）
  firecrawl browser launch-session --profile my-profile

  # 読み取り専用モードでプロファイルを使って起動する
  firecrawl browser launch-session --profile my-profile --no-save-changes

  # 短縮形：プロファイルで起動して一度に実行する
  firecrawl browser --profile my-profile "open https://example.com"
  ```
</CodeGroup>

| パラメータ         | デフォルト  | 説明                                                                                                  |
| ------------- | ------ | --------------------------------------------------------------------------------------------------- |
| `name`        | —      | 永続プロファイルの名前です。同じ名前のセッションはストレージを共有します。                                                               |
| `saveChanges` | `true` | `true` の場合、ブラウザの状態は終了時にプロファイルへ保存されます。`false` に設定すると、既存データを読み込むだけで書き込みは行いません — 複数の同時読み取りが必要な場合に便利です。 |

<Note>
  一度に 1 つのセッションだけがプロファイルへ保存できます。ほかのセッションがすでに保存中の場合、`409` エラーが返されます。同じプロファイルを `saveChanges: false` で開くことはできますが、そうでなければ時間をおいて再試行してください。
</Note>

ブラウザセッションの状態は、セッションがクローズされたときにのみ保存されます。そのため、再利用できるよう、使い終わったらブラウザセッションをクローズすることを推奨します。セッションがクローズされると、そのセッション ID は無効になり、再利用できなくなります。代わりに、同じプロファイル名で新しいセッションを作成し、レスポンスで返される新しいセッション ID を使用してください。保存してクローズするには:

<CodeGroup>
  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  await firecrawl.deleteBrowser("YOUR_SESSION_ID");
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  app.delete_browser("YOUR_SESSION_ID")
  ```

  ```bash CLI theme={null}
  # アクティブなセッションを閉じる
  firecrawl browser close

  # 特定のセッションを閉じる
  firecrawl browser close --session <id>
  ```

  ```bash cURL theme={null}
  curl -X DELETE "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"
  ```
</CodeGroup>

<div id="list-sessions">
  ### セッション一覧を取得する
</div>

<CodeGroup>
  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  const { sessions } = await firecrawl.listBrowsers();
  console.log(sessions);

  // ステータスでフィルター
  const { sessions: active } = await firecrawl.listBrowsers({ status: "active" });
  console.log(active);
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  response = app.list_browsers()
  print(response.sessions)
  ```

  ```bash CLI theme={null}
  firecrawl browser list
  firecrawl browser list active
  ```

  ```bash cURL theme={null}
  curl -X GET "https://api.firecrawl.dev/v2/interact" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"

  # ステータスでフィルター
  curl -X GET "https://api.firecrawl.dev/v2/interact?status=active" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"
  ```
</CodeGroup>

```json Response theme={null}
{
  "success": true,
  "sessions": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "status": "active",
      "cdpUrl": "wss://browser.firecrawl.dev/cdp/550e8400...?token=abc123...",
      "liveViewUrl": "https://liveview.firecrawl.dev/...",
      "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
      "createdAt": "2025-01-15T10:30:00Z",
      "lastActivity": "2025-01-15T10:35:00Z"
    }
  ]
}
```

<div id="ttl-configuration">
  ### TTL 設定
</div>

セッションには 2 種類の TTL 設定があります:

| Parameter     | Default       | Description                    |
| ------------- | ------------- | ------------------------------ |
| `ttl`         | 600s (10 min) | セッションの最大存続時間 (30-3600s)        |
| `activityTtl` | 300s (5 min)  | 非アクティブ時の自動クローズまでの時間 (10-3600s) |

<div id="close-a-session">
  ### セッションを終了する
</div>

<CodeGroup>
  ```js Node theme={null}
  import { Firecrawl } from 'firecrawl';

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

  await firecrawl.deleteBrowser("YOUR_SESSION_ID");
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl

  app = Firecrawl(api_key="fc-YOUR-API-KEY")

  app.delete_browser("YOUR_SESSION_ID")
  ```

  ```bash CLI theme={null}
  # アクティブなセッションを閉じる
  firecrawl browser close

  # 特定のセッションを閉じる
  firecrawl browser close --session <id>
  ```

  ```bash cURL theme={null}
  curl -X DELETE "https://api.firecrawl.dev/v2/interact/YOUR_SESSION_ID" \
    -H "Authorization: Bearer $FIRECRAWL_API_KEY"
  ```
</CodeGroup>

<div id="live-view">
  ## ライブビュー
</div>

各セッションのレスポンスには `liveViewUrl` が含まれており、これを埋め込むことでブラウザーの状態をリアルタイムで確認できます。デバッグ、デモ、ブラウザー駆動型 UI の構築などに便利です。

```json Response theme={null}
{
  "success": true,
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "cdpUrl": "wss://browser.firecrawl.dev/cdp/550e8400...?token=abc123...",
  "liveViewUrl": "https://liveview.firecrawl.dev/...",
  "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
  "expiresAt": "2025-01-15T10:40:00Z"
}
```

```html theme={null}
<iframe src="LIVE_VIEW_URL" width="100%" height="600" />
```

<div id="interactive-live-view">
  ### インタラクティブ Live View
</div>

レスポンスには `interactiveLiveViewUrl` も含まれます。閲覧専用の標準的な Live View と異なり、インタラクティブ Live View では、埋め込みストリームを通じてユーザーがブラウザセッションを直接操作できます (クリックや文字入力など) 。これは、ユーザー向けのブラウザ UI の構築、共同でのデバッグ、あるいは閲覧者がブラウザを操作する必要があるあらゆるシナリオに有用です。

```html theme={null}
<iframe src="INTERACTIVE_LIVE_VIEW_URL" width="100%" height="600" />
```

<div id="connecting-via-cdp">
  ## CDP 経由での接続
</div>

すべてのセッションは CDP WebSocket URL を提供します。`execute` API と `--bash` フラグでほとんどのユースケースはカバーできますが、完全にローカルで制御したい場合は、直接接続することもできます。

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { Firecrawl } from 'firecrawl';
  import { chromium } from "playwright-core";

  const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });
  const session = await firecrawl.browser();

  const browser = await chromium.connectOverCDP(session.cdpUrl);
  const context = browser.contexts()[0];
  const page = context.pages()[0] || (await context.newPage());

  await page.goto("https://example.com");
  console.log(await page.title());

  await browser.close();
  await firecrawl.deleteBrowser(session.id);
  ```

  ```python Python theme={null}
  from firecrawl import Firecrawl
  from playwright.sync_api import sync_playwright

  app = Firecrawl(api_key="fc-YOUR-API-KEY")
  session = app.browser()

  with sync_playwright() as p:
      browser = p.chromium.connect_over_cdp(session.cdp_url)
      context = browser.contexts[0]
      page = context.pages[0] if context.pages else context.new_page()

      page.goto("https://example.com")
      print(page.title())

      browser.close()

  app.delete_browser(session.id)
  ```

  ```bash agent-browser theme={null}
  # セッションのレスポンスで返される cdpUrl を使用
  agent-browser open https://example.com --cdp "$CDP_URL"
  agent-browser snapshot --cdp "$CDP_URL"
  ```
</CodeGroup>

<div id="when-to-use-browser">
  ## Browser を使うべきタイミング
</div>

| ユースケース                           | 適切なツール                        |
| -------------------------------- | ----------------------------- |
| 既知の URL からコンテンツを抽出する             | [Scrape](/ja/features/scrape) |
| Web を検索して結果を取得する                 | [Search](/ja/features/search) |
| ページネーションの操作、フォーム入力、クリックを伴うフローの操作 | **Browser**                   |
| インタラクションを伴うマルチステップのワークフロー        | **Browser**                   |
| 複数のサイトを並列にブラウジングする               | **Browser** (各セッションは分離されている)  |

<div id="use-cases">
  ## ユースケース
</div>

* **競合分析** - 競合サイトを閲覧し、検索フォームやフィルターを操作して、価格や機能を構造化データとして抽出する
* **ナレッジベースの取り込み** - クリック操作、ページネーション、認証が必要なヘルプセンター、ドキュメント、サポートポータルを辿る
* **市場調査** - 複数のブラウザーセッションを並列で起動し、求人サイト、不動産リスティング、法的データベースなどからデータセットを構築する

<div id="pricing">
  ## 料金
</div>

料金体系はシンプルで、ブラウザの稼働1分あたり2クレジットです。無料プランでは最大5時間まで無料で利用できます。

<div id="rate-limits">
  ## レート制限
</div>

初期リリースでは、すべてのプランで最大 20 個のブラウザーセッションを同時に稼働させることができます。

<div id="api-reference">
  ## API リファレンス
</div>

* [ブラウザセッションを作成](/ja/api-reference/endpoint/browser-create)
* [ブラウザコードを実行](/ja/api-reference/endpoint/browser-execute)
* [ブラウザセッションの一覧を取得](/ja/api-reference/endpoint/browser-list)
* [ブラウザセッションを削除](/ja/api-reference/endpoint/browser-delete)

***

ご意見やご不明な点がありましたら、[help@firecrawl.com](mailto:help@firecrawl.com) までメールいただくか、[Discord](https://discord.gg/firecrawl) でご連絡ください。

> Firecrawl API key が必要な AI agent の方は、[firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) の自動オンボーディング手順をご覧ください。
