CLOUSD
免費註冊
了解基準測試Agent 在 Clousd 手機上的成績部落格即將推出指南、深度解析與實戰筆記比較即將推出Clousd 與其他方案比較
開發整合即將推出MCP、Claude Code、Codex、Cursor、n8nGitHubSDK、MCP 伺服器與範例
閱讀文件

整合

Python SDK

幾行 Python 就能交代手機任務、寫自動化腳本。

安裝

終端機
pip install clousd
export CLOUSD_API_KEY=cl_live_…

一個任務

Python
from clousd import Clousd

c = Clousd()                                   # key from CLOUSD_API_KEY
run = c.run("Open Settings and tell me the Android version", device="c3f9a41d2", wait=True)
print(run.status, run.answer)                  # completed  Android 15

# the same task on several phones at once
run = c.run("Open the app and tell me what the first screen shows", devices=["c3f9a41d2", "c81d07e5a"], wait=True)
for r in run.children:
    print(r.device, r.status, r.answer)

追蹤與回覆

Python
login = c.credentials("com.example.shop")[0]  # names only; the values never leave Clousd
run = c.run("Sign in and tell me how many orders there are", device="c3f9a41d2", credentials=[login], mode="ask",
            output_schema={"type": "object", "properties": {"orders": {"type": "integer"}}})
for ev in run.events():                        # live: status, plan, step, card, answer, end
    if ev["event"] == "step":
        print(ev["data"]["n"], ev["data"]["tool"], ev["data"]["result"])
    if ev["event"] == "card":
        run.reply(allow=True)                  # or run.reply("the first one")
print(run.refresh().structured_output)         # {"orders": 3}
任務登入資訊、排程、Webhook
c.run(task, device=… / devices=[…])、device.run(task)c.credentials()、c.add_credential(package, name, fields)
run.wait(), run.events(), run.trajectory()c.schedules()、c.add_schedule(task, devices, at, days, tz, every="hour", trigger="api", more=[…])、c.run_schedule(id)
run.reply()、run.message()、run.cancel()、c.runs()c.webhooks()、c.add_webhook(url, events)

逐步操作

Python
phone = c.device("c3f9a41d2")
phone.open_app("com.android.chrome")           # act
phone.tap_text("Search")
phone.type("weather in Berlin")
phone.key("enter")
phone.wait_text("Berlin", timeout=30)          # check
png = phone.screenshot(width=540)              # look
查看操作
screenshot(), screen_text(), find_text()tap()、swipe()、scroll()、type()、key()
observe()、size()、installed()open_app(), open_url(), tap_text(), wait_text()
notifications()、crashes()、health()start(), stop(), restart(), reset()

耗時較長的裝置操作會回傳 Job,預設會等它完成;傳入 wait=False 可以自己輪詢。發生錯誤時會拋出 ClousdError,附上 HTTP 狀態碼和訊息。遇到 429 時用戶端會自動等待並重試。在終端機:clousd run "…" --device … 會即時顯示每個步驟。

原始碼與範例:GitHub 上的 clousd-sdk。