Runtime Overview
Retrieve a connected user session and execute custom automation scripts
Anon’s Runtime SDK allows you to run custom automation scripts on connected user sessions. This guide will show you how to get started with the Runtime SDK.
Getting Started
Create a .npmrc
file in the root of your project to gain access to our private package registry:
Add the SDK to your project’s dependencies:
This reference is for the v0.8.0 SDK. Please see here for older versions.
Below is an example of how to use the Runtime SDK to post content on LinkedIn:
You’ll need the appUserId
of a user that you’ve previously linked an account with to run this code example. This is typically an email address.
Configuration
The anon.run()
function has a variety of configuration options to fit any use case.
You can configure where the browser runs, how network traffic is proxied, timeouts, and more.
Runtime Hosting
By default, the browser is a managed instance hosted by Browserbase. This is best for most use cases as it alleviates the need for you to manage your own browser infrastructure.
You can also use your own instance if it has an externally accessible CDP (Chrome
Devtools Protocol) URL. Note that localhost
endpoints are not typically
externally accessible.
Remote Browser
This example injects your account sessions into an existing browser instance already running on a Browserbase CDP URL.
Timeouts
A managed browser instance has a finite lifetime. You can adjust the lifetime
using the sessionDuration
parameter. This specifies the browser lifetime in
seconds.
Setting browser instance lifetime:
Monitoring
Live Session Rendering
Even though our managed instances are headless, you and your users can observe a rendered view of the webpage live.
You can even embed the webpage as an iframe. This can be shared with your users so that they can watch the automations as they happen.
Logs
You can pass in a custom Logger
to the
browser initialization for fine-grained control over logging:
Screenshots
You can plug into the existing Playwright screenshot functionality as follows:
Next Steps
Was this page helpful?