Introduction

Run continuous tasks and workflows with a long-lived browser session

Why Browser Sessions?

Skyvern Browser Session is a way to persist the real-time state of the browser, so that any run can continue from where the previous run left off. Here are some scenarios when Skyvern Browser Session comes in handy:

  • You have multiple continuous tasks that need to interact with the browser in real-time without much delay. For example, you are developing a phone agent for your customer support center and your agent needs access to real time information in the browser.
  • You have several related tasks that may need to be executed but with interruptions in between. For example, you are developing an shopping agent that needs human in the loop to help fulfill the purchase.

Skyvern Browser Sessions are currently only available via API & SDK.

Create a Browser Session

1from skyvern import Skyvern
2
3skyvern = Skyvern(api_key="YOUR_API_KEY")
4browser_session = await skyvern.create_browser_session(
5 timeout=60,
6)
  • The timeout parameter (>=5, <=10080) is the max time in minutes that the browser session can run. By default, the timeout is 60 minutes.
  • The browser_session_id the session ID you should note.

Get A Browser Session

1from skyvern import Skyvern
2
3skyvern = Skyvern(api_key="YOUR_API_KEY")
4browser_session = await skyvern.get_browser_session(
5 browser_session_id="YOUR_BROWSER_SESSION_ID",
6)

Close A Browser Session

1from skyvern import Skyvern
2
3skyvern = Skyvern(api_key="YOUR_API_KEY")
4await skyvern.close_browser_session(
5 browser_session_id="YOUR_BROWSER_SESSION_ID",
6)