POST
/
boxes
/
{boxId}
/
actions
/
ai
JavaScript
import GboxSDK from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});

async function main() {
  const box = await gboxSDK.create({ type: "android" });

  await box.action.ai("click the login button");

  await box.action.ai({
    instruction: "click the login button",
    background: "You are a QA engineer. You are testing the login page of the application."
  });
}

main();
{
  "screenshot": {
    "trace": {
      "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
    },
    "before": {
      "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
    },
    "after": {
      "uri": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA..."
    }
  },
  "output": "Action executed successfully",
  "aiResponse": {
    "model": "open-ai-computer-use-preview",
    "reasoning": "The button is on the login page. so i will click the button",
    "messages": [
      "The button is on the login page. so i will click the button",
      "The button is clicked"
    ],
    "actions": [
      {
        "type": "click",
        "x": 100,
        "y": 100
      }
    ]
  }
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer <token>. Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

Body

application/json

AI action configuration

Response

200 - application/json

Result of AI action execution with screenshot