Downloads
Kernel browsers run in fully sandboxed environments with writable filesystems. When your automation downloads a file, it’s saved inside the browser’s filesystem and can be retrieved using Kernel’s File I/O APIs.Playwright
Playwright performs downloads via the browser itself, so there are a few steps:- Create a browser session
- Configure where the browser saves downloads using CDP
- Perform the download
- Retrieve the file from the browser’s filesystem
The CDP
downloadProgress event signals when the browser finishes writing a
file, but there may be a brief delay before the file becomes available through
Kernel’s File I/O APIs. This is especially true for larger downloads. We
recommend polling listFiles to confirm the file exists before attempting to
read it.We recommend using the list files API to poll for file availability before calling read file, as shown in the examples above. This approach ensures reliable downloads, especially for larger files. You can also use
listFiles to enumerate and save all downloads at the end of a session.Stagehand v3
When using Stagehand with Kernel browsers, you need to configure the download behavior in thelocalBrowserLaunchOptions:

