Skip to Content

AI駆動開発にプロダクトの継続的な品質検証を

AIエージェントと開発すると、変更は速く、多くなります。コードとテストが通っても、ユーザーが目的を果たせるとは限りません。ProbeはE2Eテストの範囲を、1つの画面やAPIからカスタマージャーニー全体に広げます。ブラウザでのサインアップから、届いたメール、データベースの行、iOSアプリでのサインインまでをGitHub ActionsのようなYAMLのWorkflowで検証し、初めて使う人をAIエージェントに演じさせて、目的を果たせたかも判定します。同じWorkflowを変更のたびにCIで、リリースのあとも一定間隔で実行し、体験が壊れていないことを確かめ続けます。

サインアップのシナリオの例

Sign upbrowserFill in the formAPIhttpSign-in is refusedDatabasedbRow is pendingMailboximapConfirmation arrivedActivatebrowserFollow the linkiOS appiosSign in on iPhoneFirst visitagentAda names herself

最初にSign upがChromeでフォームに入力して送信します。API、Database、Mailboxはその結果を同時に確かめます。APIは確認前のアドレスでのサインインを拒否し、SQLiteのレコードはpendingのままで、IMAPで開いたメールボックスには確認メールが届いています。Activateはこの3つを待ってから、メールのリンクをブラウザで開きます。そのあとの2つは同時に走ります。iOS appはiPhoneのシミュレータからサインインし、First visitは初めてアプリを使うAdaをAIエージェントに演じさせて、目的を果たせたかを判定させます。手順を1つずつ書くテストでは確かめられない、使いやすさの検証です。

signup-flow.yml
1name: Sign-up Flow2 3actions:4  browser: github.com/mozership/probe-browser@5e0ee79cb660e5c855414935f51ad3eeb7c6ad6e # v0.6.15  ios: github.com/mozership/probe-ios@aed5436143e9536754e2123b953831f60cd635eb # v0.2.06  agent: github.com/mozership/probe-agent@4d0d6ccee6165624283b22fa0541b02d17e50ac5 # v0.2.07  db: github.com/mozership/probe-db@47be79a26c62a4790015c9fc2680bce4dba210b6 # v0.1.08  imap: github.com/mozership/probe-imap@c64e6ad9559de7a1405976fdaa11e7091bc732ee # v0.1.09 10secrets:11- ANTHROPIC_API_KEY12 13vars:14  web: https://app.example.com15  api: https://api.example.com16  mail_user: ada@example.com17  mail_pass: "{{MAIL_PASS}}"18  password: "{{PASSWORD}}"19 20jobs:21- name: Sign up22  id: signup23  steps:24  - name: Fill in the form25    uses: browser26    with:27      timeout: 15s28      actions:29      - name: navigate30        url: "{{vars.web}}/signup"31      - name: type32        selector: "#email"33        value: "{{vars.mail_user}}"34      - name: type35        selector: "#password"36        value: "{{vars.password}}"37      - name: click38        selector: button[type=submit]39      - name: wait_text40        id: notice41        selector: "#notice"42    test: res.code == 0 && res.results.notice startsWith "Check your inbox"43 44- name: API45  id: api46  needs: [signup]47  defaults:48    http:49      url: "{{vars.api}}"50      headers:51        content-type: application/json52  steps:53  - name: Sign-in is refused54    uses: http55    with:56      post: /login57      body:58        email: "{{vars.mail_user}}"59        password: "{{vars.password}}"60    test: res.code == 403 && res.body.error == "confirm your address first"61 62- name: Database63  id: db64  needs: [signup]65  defaults:66    db:67      dsn: file:./app.db68  steps:69  - name: Row is pending70    uses: db71    with:72      query: SELECT status FROM users WHERE email = ?73      params: ["{{vars.mail_user}}"]74    test: res.code == 0 && res.rows[0].status == "pending"75 76- name: Mailbox77  id: mailbox78  needs: [signup]79  defaults:80    imap:81      host: imap.example.com82      username: "{{vars.mail_user}}"83      password: "{{vars.mail_pass}}"84  steps:85  - name: Confirmation arrived86    id: mail87    uses: imap88    with:89      commands:90      - name: select91        mailbox: INBOX92      - name: fetch93        sequence: "1"94        dataitem: ENVELOPE BODY[TEXT]95    test: |96      res.code == 0 &&97      res.data.fetch.messages[0].subject == "Confirm your address" &&98      res.data.fetch.messages[0].to == vars.mail_user99    outputs:100      link: last(split(trim(res.data.fetch.messages[0].body), "\r\n"))101 102- name: Activate103  id: activate104  needs: [api, db, mailbox]105  steps:106  - name: Follow the link107    uses: browser108    with:109      timeout: 15s110      actions:111      - name: navigate112        url: "{{outputs.mail.link}}"113      - name: text114        id: heading115        selector: h1116    test: res.code == 0 && res.results.heading == "Your account is active"117 118- name: iOS app119  id: ios120  needs: [activate]121  steps:122  - name: Sign in on iPhone123    uses: ios124    timeout: 10m125    with:126      app: com.example.acme127      actions:128      - name: launch129        args: ["-api", "{{vars.api}}"]130      - name: type131        selector: email132        value: "{{vars.mail_user}}"133      - name: type134        selector: type=securetextfield identifier=password135        value: "{{vars.password}}"136      - name: tap137        selector: signin138      - name: text139        id: greeting140        selector: greeting141    test: res.code == 0 && res.results.greeting == "Welcome, ada@example.com"142 143- name: First visit144  id: visit145  needs: [activate]146  steps:147  - name: Ada names herself148    uses: agent149    with:150      url: "{{vars.web}}/signin"151      persona: |152        Ada, who has just confirmed her address and has153        never used the app. She signs in with {secret:EMAIL}154        and the password {secret:PASSWORD}.155      goal: |156        Sign in, and set the display name of the account157        to "Ada Lovelace".158      secrets:159        EMAIL: "{{vars.mail_user}}"160        PASSWORD: "{{vars.password}}"161      evidence_dir: out162    test: res.verdict == "pass"
$ probe signup-flow.yml
Sign-up Flow ⏺ Sign up (Completed in 3.25s)  ⎿ 0. ✓  Fill in the form ⏺ API (Completed in 0.03s)  ⎿ 0. ✓  Sign-in is refused ⏺ Database (Completed in 0.04s)  ⎿ 0. ✓  Row is pending ⏺ Mailbox (Completed in 0.05s)  ⎿ 0. ✓  Confirmation arrived ⏺ Activate (Completed in 1.02s)  ⎿ 0. ✓  Follow the link ⏺ iOS app (Completed in 53.90s)  ⎿ 0. ✓  Sign in on iPhone ⏺ First visit (Completed in 29.86s)  ⎿ 0. ✓  Ada names herself         ✅ pass: Signing in led to /home, so the persona got into the app. On the Account page she typed "Ada Lovelace" and saved, and the page showed "Saved." at /account?saved=1. The tester then opened /account again as a new page load. The page's form data shows the Display name field holding value="Ada Lovelace", and the screenshot shows the same name, so the change was kept. No server errors or slow requests turned up. The only failed request was the site icon (favicon.ico, 404), which the persona would not notice.           evidence: "Home · Account Your projects You have no projects yet."           evidence: "Saved."           evidence: "textbox \"Display name\" value=\"Ada Lovelace\" [ref_7]"           0 findings           21 steps, stopped: done, 28s           report: out/probe-agent-1662083251/report.md Total workflow time: 58.23s ✓ All jobs succeeded

構造

Workflowの構成要素

WorkflowはJobの集まりで、JobはStepの並びです。Stepは書いた順に1つずつ走ります。Jobは既定で並列に走り、needsを書いたものだけが依存先の完了を待ちます。Jobにrepeatを足せば、同じファイルが一定間隔で走り、成功率を返します。

WorkflowneedsJobStepStepStepJobStepStepJobStep
ジョブとステップを読む

仕組み

サポートしているアクション

Stepのusesにアクション名を書くと、Probeはそのアクションを別プロセスとして起動し、gRPC越しにやり取りします。ビルトインのアクションも、自作のアクションとまったく同じ手順で接続されます。特別扱いされているものは1つもないので、必要なアクションが無ければ自分で追加できます。

gRPCprobeワークフロー実行ビルトインhttpshellsshsmtpfileembedded自作のアクションagentgraphqljmap
アクションリファレンスを読む

再利用

共通処理は別のファイルに

シナリオの多くはログインから始まり、2つ目以降のシナリオでも同じ手順を書くことになります。その手順をジョブファイルに置けば、どのWorkflowからもuses: embeddedで実行でき、varsを渡してoutputsを受け取れます。呼び出したジョブのStepはレポートでも入れ子で表示されるため、失敗したときにどのStepかがわかります。

orders.yml
1name: Orders2 3vars:4  password: "{{PASSWORD}}"5 6jobs:7- name: Order history8  defaults:9    http:10      url: https://api.example.com11 12  steps:13  - name: Log in14    id: auth15    uses: embedded16    with:17      path: ./login-job.yml18      vars:19        username: ada20        password: "{{vars.password}}"21    test: res.code == 022    outputs:23      token: res.outputs.token24 25  - name: List orders26    uses: http27    with:28      get: /orders29      headers:30        authorization: "Bearer {{outputs.auth.token}}"31    test: res.code == 200
login-job.yml
1name: Log in2 3defaults:4  http:5    url: https://api.example.com6    headers:7      content-type: application/json8 9steps:10- name: Post credentials11  id: login12  uses: http13  with:14    post: /login15    body:16      username: "{{vars.username}}"17      password: "{{vars.password}}"18  test: res.code == 20019  outputs:20    token: res.body.access_token
embeddedアクションのリファレンスを読む

記法

Stepで使用できる便利な機能

Stepにはアクションの設定以外に、以下の共通機能があります。

test

式が真ならそのStepは成功です。レスポンスの中身はすべて参照できます。

yaml
1test: res.code == 200 && res.body.status == "ok"

outputs

値に名前をつけておくと、あとのStepやJobから読めます。

yaml
1outputs:2  token: res.body.access_token

iteration

変数の組ごとに、同じStepをコピーせず繰り返します。

yaml
1iteration:2- {name: Alice, role: admin}3- {name: Bob, role: user}

retry

失敗したときに、間隔をあけてやり直します。

yaml
1retry:2  max_attempts: 33  interval: 5s

skipif

条件に当てはまるときは、そのStepを飛ばします。

yaml
1skipif: vars.env == "local"

wait

先に落ち着くのを待ちたいとき、実行前に待機します。

yaml
1wait: 5s

品質

決定論的なテストでは書けない品質を

ここまでのStepは厳密に書ける正しさを確かめるもので、マージの関門になるべきものです。一方で、初めての人が最後までたどり着けるか、データや設定が積み重なったステージングでもアプリケーションが持ちこたえるかは、式では書けません。agentアクションでは、それをペルソナと目標として自然言語で書きます。モデルが実際のChromeでペルソナを演じ、別に呼び出したモデルが、ページとリクエストの記録に裏付けられた指摘だけを残します。repeatを付けてステージングで回せば、人と同じようにアプリケーションを使い続けます。

使えるモデル

  • Claude
  • OpenAI
  • Gemini
  • xAI
  • さくらのAI Engine
first-note.yml
1name: First note2 3actions:4  agent: github.com/mozership/probe-agent@4d0d6ccee6165624283b22fa0541b02d17e50ac5 # v0.2.05 6vars:7  password: "{{PASSWORD}}"8 9jobs:10- name: A first-time visitor11  steps:12  - name: Writes a first note13    uses: agent14    with:15      url: https://staging.example.com/16      persona: |17        Carol, who has never used a notes app and is18        not technical. She signs up with {secret:EMAIL}19        and the password {secret:PASSWORD}.20      goal: |21        Create an account, and write a first note22        that says "Buy milk".23      secrets:24        EMAIL: "carol+{{random_str(8)}}@example.com"25        PASSWORD: "{{vars.password}}"26      evidence_dir: out27    test: res.verdict != "blocked"
$ probe first-note.yml
First note ⏺ A first-time visitor (Completed in 48.49s)  ⎿ 0. ✓  Writes a first note         ❌ fail: The account was created: the welcome page greeted Carol and said the account was ready. No note was ever written, though. The only way to write one is the "Write your first note" link to /notes/new, and that page returned a 500 "Internal Server Error" all three times it was loaded. Nothing in the record shows a "Buy milk" note being saved.           evidence: "Welcome to Acme Notes, Carol!"           evidence: "Your account {secret:EMAIL} is ready."           evidence: "link \"Write your first note\" href=\"/notes/new\""           evidence: "Internal Server Error"           2 findings           🔴 high: The new-note page (/notes/new) fails with a server error (500)           🟠 medium: After sign-up, nothing shows Carol is signed in and there is no other way to reach notes           24 steps, stopped: done, 47s           report: out/probe-agent-3220800333/report.md Total workflow time: 48.49s ✓ All jobs succeeded

1つ目の指摘はサーバーのエラーで、誰かがhttpのStepを書いていれば見つけられたものです。2つ目はどのテストにも書かれていません。登録したあと、ログインしていることも、メモへたどり着く道も、Carolには示されていません。このStepのtestはレビューが実行できたことだけを確かめ、判定と指摘は読むための結果として返ります。

agentアクションのリファレンスを読む

AIエージェント

AIエージェントのために

AIエージェントがコードとテストを書くなら、その両方を確かめる仕組みが要ります。Probeは動いているバージョンの使い方をAIエージェントに教え、Workflowの誤りを実行前に見つけ、レスポンスの正しさをAIエージェント自身のtestではなく仕様で判定し、書き込みや許可していないホストへの接続を送信前に拒否します。

agent-workflow.yml
1name: Profile2 3jobs:4- name: Profile5  defaults:6    http:7      url: https://api.example.com8  steps:9  - name: Log in10    id: login11    uses: http12    with:13      post: /login14      bdoy:15        username: ada16    test: res.code == 20017    outputs:18      token: res.body.token19 20  - name: Read profile21    uses: http22    with:23      get: /me24      headers:25        authorization: "Bearer {{outputs.login.tokn}}"26    tset: res.code == 200
$ probe check agent-workflow.yml
agent-workflow.yml:14: error: job 0 "Profile", step 0 "Log in": with: unknown key "bdoy" for the http action; did you mean "body"?agent-workflow.yml:20: warning: job 0 "Profile", step 1 "Read profile": nothing checks this step: it has no testagent-workflow.yml:25: error: job 0 "Profile", step 1 "Read profile": with: outputs.login.tokn is not published: step "login" publishes tokenagent-workflow.yml:26: error: job 0 "Profile", step 1 "Read profile": unknown key "tset"; did you mean "test"? 3 errors, 1 warning

probe checkはWorkflowを実行せずに読みます。Stepやwithのキーの綴りを間違えると、実行時には無視されて別の理由で通ってしまうことがあります。outputsの名前の誤りは、実行してそのStepに来るまでわかりません。ここではどれも何かを送る前に行番号つきのエラーになり、何も確かめていないStepは警告になります。

skill

Workflowの書き方、実行、失敗の読み方を教えるスキルを入れます。AIエージェントはバイナリに組み込まれたリファレンスをprobe guideで読むので、動いているバージョンに合ったYAMLを書きます。

shell
1probe skill install2probe guide http

openapi

リクエストとレスポンスをOpenAPIのドキュメントと照合します。正しさを決めるのはAIエージェントが書いたtestではなく仕様なので、間違ったtestが間違ったレスポンスを通すことはありません。

yaml
1uses: http2with:3  get: /users/14  openapi:5    spec: ./openapi.yml

proto

gRPCでも同じく.protoファイルと照合します。buf.validateのルールとgoogle.api.field_behaviorも確かめます。

yaml
1uses: grpc2with:3  method: GetUser4  proto:5    files: [./proto/user/v1/user.proto]

coverage

実行したStepが仕様のどのオペレーション、レスポンス、メソッドを確かめたか、まだどれが残っているかを示します。

shell
1probe --report json workflow.yml2probe coverage openapi.yml \3  probe-report.json

--read-only

AIエージェントが書いたWorkflowを、書き込ませずに走らせます。読み取り以外の操作と、許可していないホストへの接続は、送る前に拒否します。

shell
1probe --read-only \2  --allow-host api.staging.example.com \3  workflow.yml

exit code

終了コードで何を調べればよいかがわかります。testや仕様の違反か、Workflow自体の誤りか、相手が応答しなかったかを区別します。

shell
1probe workflow.yml2echo $?  # 1 test, 2 workflow, 3 action
AIエージェント向けにプロジェクトを設定する

はじめる

インストール

Probeは実行時の依存がない、単体のバイナリです。Homebrewなら1つのコマンドで入ります。

$ brew install mozership/tap/probe

Goでインストールする場合

go install github.com/mozership/probe/cmd/probe@latest
インストールガイドを読む

FAQ

よくある質問

AIエージェントを使っていなくても使えますか?

使えます。WorkflowはただのYAMLで、誰が書いてもProbeは同じように実行します。実行前にWorkflowの誤りを見つけるといった、ProbeがAIエージェントのためにしていることは、人が手で書くときにもそのまま役立ちます。

クイックスタートを読む →
runn、Hurl、k6とはどう違いますか?

Probeは1つのYAMLから、ブラウザ、iOSアプリ、HTTP、データベース、メールを操作し、needsが許す範囲でJobを並列に走らせます。実体は単一のバイナリです。負荷をかけることはできないので、性能の測定にはk6を使ってください。HTTPだけならHurlのほうが軽く書けます。

類似ツールと比べる →
CIで動かせますか?

動かせます。GitHub Actionsでは、mozership/probe-actionがProbeをダウンロードし、チェックサムを検証してキャッシュし、Workflowを実行します。終了コードで何を調べればよいかがわかり、1はtestの失敗、2はWorkflow自体の誤り、3は相手が応答しなかったことを表します。iOSアクションにはmacOSのランナーが必要で、そこではgo installでProbeを入れます。

GitHub Actionsで使う →
AIエージェントが書いたWorkflowが、触ってはいけないシステムを変えてしまいませんか?

ガードを付けて実行すれば防げます。--read-onlyは書き込みを、--allow-hostは指定していないホストへの接続を、送信する前に拒否します。Workflowの中からこれを緩めることはできません。ブラウザやagentのように、何をするかを事前に判断できないアクションは、--allow-actionで名前を挙げない限りガードの下では拒否されます。

ガードについて読む →
決定論的でないagentアクションは何のためにあるのですか?

決定論的なStepでは書けないことを確かめるためです。ステータスやレコードやメールは正確に検証でき、マージの可否はそうしたStepで決めるべきです。一方で、初めての利用者がページを迷わず進めるか、データや設定が積み重なったステージングでもアプリケーションが持ちこたえるかは、期待値として書けません。agentアクションはそれを、本物のChromeでアプリケーションを使うモデルに任せます。決定論的なStepを置き換えるものではなく、その外側を補うものです。

決定論的なテストが取りこぼすもの →
agentアクションはモデルに判断させます。結果は毎回変わりませんか?

変わることがあります。判定ではページに表示された内容を引用し、その引用が実際にページにあったかを記録します。判定できなかったことを表すblockedは、failと区別されます。シナリオテストなら、通った実行の手順を保存し、モデルを使わずに再生できます。その場合も判定だけはモデルに改めて任せます。

agentアクションを読む →
iOSやAndroidのアプリをテストするには何が必要ですか?

iOSアクションはXcodeの入ったmacOSで動き、アプリを入れて起動したシミュレータを操作します。AndroidアクションはLinuxとmacOSでadb越しに動き、エミュレータか実機を操作します。端末に入れるのはテストするアプリだけです。どちらも端末の起動やアプリのインストールはしないので、その前のshellのStepで済ませておきます。

iOSアクションを読む →
必要なプロトコルに対応していないときは?

アクションを書けば追加できます。ProbeはアクションとgRPCでやり取りするので、どの言語でも書けます。ビルトインのアクションも同じ手順で接続されています。外部アクションはWorkflowの中でコミットSHAで固定し、Probeはそのコミットのaction.ymlがSHA-256を示す実行ファイルだけを実行します。

アクションについて読む →
無料ですか?

無料です。ProbeはMIT Licenseのオープンソースです。agentアクションは、選んだモデルの提供元のAPIを自分のAPIキーで呼ぶので、その利用料は提供元から請求されます。

GitHubで見る →