You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/site/docs/en/api.mdx
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,23 @@ All agents share these base options:
37
37
Then access the report via `http://localhost:3000` (or the port shown in the terminal).
38
38
-`screenshotShrinkFactor: number`: Controls the scaling ratio of screenshots to reduce the image size sent to the AI model, thereby reducing token consumption. The default value is 1 (no scaling). If set to 2, the width and height of the screenshot will be halved, and the area will be reduced to a quarter of the original. You can adjust this value based on your actual situation to find the best balance between image clarity and token consumption.
39
39
- For mobile devices, setting `screenshotShrinkFactor` to 2 can reduce token consumption while maintaining clarity, but it is not recommended to set it higher than 3, as this may cause the image to be too blurry and affect the AI model's understanding.
40
-
- For web pages, if the content is complex or contains a lot of details, it is not recommended to set `screenshotShrinkFactor` to avoid overly blurry screenshots. Additionally, if you want higher clarity for web page screenshots, you can configure Puppeteer or Playwright's `deviceScaleFactor` to 2, which will allow Puppeteer or Playwright to render the page as if it were a high-definition screen.
40
+
- For web pages, if the content is complex or contains a lot of details, avoid setting `screenshotShrinkFactor` too high to prevent overly blurry screenshots. You can usually control screenshot size earlier in the pipeline through Puppeteer or Playwright's `deviceScaleFactor`.
41
+
42
+
:::info
43
+
44
+
**Difference between `screenshotShrinkFactor` and `deviceScaleFactor`:**
45
+
46
+
-`screenshotShrinkFactor` is a Midscene-specific option. It controls whether Midscene compresses a screenshot after capturing it from devices such as browsers and phones. Its purpose is to reduce token consumption and speed up model responses, but excessive compression can blur the image and hurt the model's understanding.
47
+
48
+
-`deviceScaleFactor` is a Puppeteer and Playwright option for configuring high-DPI display adaptation. It defines how many physical pixels should be used to render one CSS logical pixel. This is why a mismatch between `deviceScaleFactor` and the actual device scale can cause page flickering in non-headless mode. The same scaling logic also determines the screenshot size generated by Puppeteer/Playwright, based on physical pixels. Compared with `screenshotShrinkFactor`, it controls screenshot size further upstream at the production stage.
49
+
50
+
**Can they be used together?**
51
+
52
+
- Web scenarios: using both usually has limited value. Prefer `deviceScaleFactor` to control screenshot size directly at the production stage.
53
+
- One exception: when you configure `deviceScaleFactor` to avoid browser flickering, but still do not want to send an oversized screenshot to the model. In that case, you can also use `screenshotShrinkFactor` to compress the image before model consumption.
54
+
- Mobile and other non-Web scenarios: `deviceScaleFactor` is not available, so use `screenshotShrinkFactor` to control the screenshot size consumed by the model.
55
+
56
+
:::
41
57
42
58
The device CLIs expose these same Agent behavior options per call. Convert the camelCase API option to a bare kebab-case flag, such as `waitAfterAction` -> `--wait-after-action`. See [Skills](./skills) for the platform CLI entry points.
0 commit comments