browser-to-api.mdupdated 2026-07-163602 words
ダブルクリックで英日反転
Applied Sciences · Engineering

browser-to-api: From CDP Trace to OpenAPI Spec

EN

A Browserbase agent skill that post-processes a recorded browser session (CDP network log) entirely offline and emits a ready-to-use OpenAPI 3.1 spec, coverage report, and client module — no live traffic capture needed.

Two-Skill Pipeline

  • browser-trace (capture): records the full CDP firehose to .o11y/<run>/cdp/network/*.jsonl during automation.
  • browser-to-api (synthesis): reads those jsonl files offline — no side effects, deterministic, re-runnable.
  • Strict separation: capture has side effects; synthesis has none. Rerun post-processing as often as needed.

What the Synthesis Step Does

  • Pairs CDP request/response events from the recorded trace.
  • Templatises observed URLs: /users/123 → /users/{id}.
  • Infers JSON schemas from response samples.
  • Outputs openapi.yaml, a human-readable coverage report, and client.mjs.

When to Use It

  • Need a proper OpenAPI spec for an undocumented third-party web API.
  • Want to extract endpoints/schemas from an existing browser-automation record.
  • Building a client/SDK against a site that publishes no spec.

Ecosystem & Installation

  • Part of Browserbase's official skills catalogue (skills.sh / browse.sh).
  • Install: npx skills add browserbase/skills. Invoke with /browser-to-api in Claude Code or Codex.
  • Similar prior art: AndrewWalsh/openapi-devtools (browser extension, manual/local form).
By splitting capture (side-effectful) from synthesis (offline, deterministic), browser-to-api lets coding agents one-shot a documented API client for any site — as Codex did for OpenTable in a single prompt.
Applied Sciences · Engineering

browser-to-api:CDPトレースから​OpenAPIスペックを​自動生成

JP

Browserbase​(=ブラウザ自動化プラットフォーム)の​公式エージェントスキル。​録画済みの​CDP​(Chrome DevTools Protocol)​ネットワークログを​オフラインで​解析し、​OpenAPI 3.1スペック・カバレッジレポート・クライアントモジュールを​生成する。

2スキル構成の​パイプライン

  • browser-trace​(キャプチャ)​:自動化実行中に​CDPの​全通​信ログを​ .o11y/<run>/cdp/network/*.jsonl に​記録。
  • browser-to-api​(合成)​:​その​jsonlを​オフラインで​処理。​副作用ゼロ・決定論的・​何度でも​再実行可能。
  • 設計の​核心:副作用を​持つキャプチャと​副作用を​持たない​合成を​完全に​分離している。

合成ステップの​処理内容

  • CDPの​リクエスト/レスポンスイベントを​ペアリング​(対応づけ)。
  • 観測された​URLを​テンプレート化:/users/123 → /users/{id}。
  • レスポンスの​サンプルから​JSONスキーマを​推論。
  • openapi.yaml・​人間が​読める​カバレッジレポート・client.mjs を​出力。

使いどころ

  • ドキュメントが​存在しない​サードパーティWebAPIの​OpenAPIスペックが​欲しい​場合。
  • 既存の​ブラウザ自動化の​記録から​エンドポイントと​スキーマを​抽出したい​場合。
  • スペックを​公開していない​サイト向けの​クライアント/SDKを​作りたい​場合。

エコシステムと​導入方​法

  • Browserbaseの​公式スキルカタログ​(skills.sh / browse.sh)の​一部。
  • インストール:npx skills add browserbase/skills。​呼び出し:/browser-to-api​(Claude Codeや​Codexから)。
  • 類似の​先行ツール:AndrewWalsh/openapi-devtools​(ブラウザ拡張・手動ローカル版)。
キャプチャ​(副作用​あり)と​合成​(オフライン・決定論的)を​分離する​ことで、​コーディングエージェントが​任意の​サイトに​対して​APIクライアントを​ワンショットで​生成できる​——Codexが​OpenTableを​単一プロンプトで​実証した​手法が​これ。
148 notestil