10
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ブラウザ上で AIエージェントを直接実行できる Mozilla の「Wasm Agents」を少し試してみた

Posted at

はじめに

以下の記事で情報を見かけた、Mozilla の「Wasm Agents」を少し試した時の話です。

●AIエージェントを余計なアプリのインストール不要でブラウザ上で直接実行可能にする「Wasm agents」をMozillaが公開、WebAssemblyを使ってブラウザ内でPythonベースのエージェントを高速実行 - GIGAZINE
 https://gigazine.net/news/20250704-wasm-agents/

image.png

公式の情報

「Wasm Agents」に関する公式の記事や GitHub のリポジトリは、以下となるようです。

●Wasm-agents: AI agents running in your browser
 https://blog.mozilla.ai/wasm-agents-ai-agents-running-in-your-browser/

●mozilla-ai/wasm-agents-blueprint: Testing WASM-powered AI agents
 https://github.com/mozilla-ai/wasm-agents-blueprint

image.png

上記を見た感じでは、クイックスタートを見て手順通りに進めれば、ちょっとしたお試しは問題なく進められそうです。

さっそく試してみる

公式のクイックスタートを見つつ、少し Wasm Agents を試してみます。

gitコマンドによるクローン

まずは、gitコマンドでリポジトリのデータをクローンしたりなどします。

git clone https://github.com/mozilla-ai/wasm-agents-blueprint.git
cd wasm-agents-blueprint/demos

ファイル・フォルダの構成の確認

上記のクローンを行った後の、ローカルのフォルダの状態は以下のとおりです。

image.png

そして、「demos」フォルダは以下のようになっています。

image.png

この後は、ちょっとした下準備をしてから、上記の HTMLファイルのうちの 1つを使ったお試しをやっていきます。

APIキーの設定と「hello_agent.html」を使ったお試し

少しだけ下準備をします。「demos」フォルダ内にあった config.js の中に、OpenAI の APIキーを設定します。

image.png

それができたら、この後は「hello_agent.html」を使ったお試しをやっていきます。

「hello_agent.html」を開いて下準備

ブラウザで「hello_agent.html」を開きます。そこで表示されたページに「Initialize Pyodide Environment」と書かれたボタンがあるので、それを押して Pyodide に関する初期化を行います。

image.png

しばらくすると、以下のようにボタン上の表示が「Environment Ready」という内容に変わりました。

image.png

これで Pyodide関連の事前対応ができた状態になります。

「hello_agent.html」で用意された設定で試す

「hello_agent.html」のページを見ていくと、AIエージェントに関する設定を行う部分があります。そして、その部分で事前に用意された複数の設定があるようです。

image.png

とりあえず、「Haiku Bot」を使う感じの設定にして、あとは「Run Agent」ボタンを押します。

その結果、上記画像の下部に出てきているように、「AGENT RESPONSE」という行の後に、英語の俳句が出力されました。

API利用履歴を見てみる

今回、OpenAI の API を使う形にしたので、OpenAI のダッシュボードページで API が使われた履歴を確認してみました。

下記のとおり GPT-4o が利用されていることが確認できました。

image.png

それと、今回は OpenAI の API を使うやり方にしましたが、以下に書かれているようにローカルLLM を組み合わせた構成にもできるようでした。

image.png

10
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?