Overview
The Skyvern TypeScript SDK provides a Playwright-compatible interface with AI-powered browser automation capabilities. It combines traditional browser automation with AI-powered task execution, allowing you to use natural language prompts alongside standard Playwright methods.Installation
Initialization
Remote Mode (Skyvern Cloud)
Connect to Skyvern Cloud or a self-hosted instance:apiKey(string, required): API key for authenticating with Skyvern. Get yours at app.skyvern.com/settingsenvironment(SkyvernEnvironment, optional): The Skyvern environment to connect toSkyvernEnvironment.Cloud(default) - Skyvern CloudSkyvernEnvironment.Staging- Staging environment
baseUrl(string, optional): Override the base URL for the Skyvern APItimeout(number, optional): Timeout in milliseconds for API requestsmaxRetries(number, optional): Maximum number of request retries
Browser Management
Launch Cloud Browser
Launch a new cloud-hosted browser session:timeout(number, optional): Timeout in minutes for the session (between 5-1440, default: 60)proxyLocation(ProxyLocation, optional): Geographic proxy location for browser traffic (Skyvern Cloud only)
Use Cloud Browser
Get or create a cloud browser session (reuses existing session if available):launchCloudBrowser()
Connect to Existing Cloud Session
Connect to an existing cloud browser session by ID:browserSessionId(string, required): The ID of the cloud browser session
Connect to Browser via CDP
Connect to an existing browser via Chrome DevTools Protocol:cdpUrl(string, required): The CDP WebSocket URL
Task Execution
Run Task
Execute a one-off AI-powered browser automation task:prompt(string, required): Natural language description of the taskengine(RunEngine, optional): Execution enginemodel(Record<string, unknown>, optional): LLM model configurationurl(string, optional): Starting URL for the taskwebhookUrl(string, optional): URL for webhook notificationstotpIdentifier(string, optional): TOTP identifier for 2FAtotpUrl(string, optional): URL to fetch TOTP codestitle(string, optional): Human-readable title for the taskerrorCodeMapping(Record<string, string>, optional): Custom error code mappingsdataExtractionSchema(Record<string, unknown> | string, optional): Schema for extracted dataproxyLocation(ProxyLocation, optional): Geographic proxy locationmaxSteps(number, optional): Maximum number of stepswaitForCompletion(boolean, optional): Wait for task to complete (default: false)timeout(number, optional): Timeout in seconds (default: 1800)browserSessionId(string, optional): Use existing browser sessionuserAgent(string, optional): Custom user agentextraHttpHeaders(Record<string, string>, optional): Additional HTTP headers
HttpResponsePromise<TaskRunResponse> with execution results
Data Extraction Example:
Run Workflow
Execute a pre-defined workflow:workflowId(string, required): ID of the workflow to executeparameters(Record<string, unknown>, optional): Workflow parameterstemplate(boolean, optional): Whether this is a templatetitle(string, optional): Human-readable titleproxyLocation(ProxyLocation, optional): Geographic proxy locationwebhookUrl(string, optional): Webhook notification URLtotpUrl(string, optional): TOTP URLtotpIdentifier(string, optional): TOTP identifierbrowserSessionId(string, optional): Use existing browser sessionmaxStepsOverride(number, optional): Override max stepsuserAgent(string, optional): Custom user agentbrowserProfileId(string, optional): Browser profile IDmaxScreenshotScrolls(number, optional): Maximum screenshot scrollsextraHttpHeaders(Record<string, string>, optional): Additional headersbrowserAddress(string, optional): Custom browser addressaiFallback(boolean, optional): Enable AI fallbackrunWith(string, optional): Run with specific configurationwaitForCompletion(boolean, optional): Wait for completion (default: false)timeout(number, optional): Timeout in seconds (default: 1800)
HttpResponsePromise<WorkflowRunResponse> with execution results
Login
Execute a login workflow with stored credentials:credentialType(CredentialType, required): Type of credential"skyvern"- Skyvern-stored credentials"bitwarden"- Bitwarden credentials"1password"- 1Password credentials"azure_vault"- Azure Key Vault credentials
url(string, optional): Login page URLcredentialId(string, optional): Skyvern credential ID (for"skyvern"type)bitwardenCollectionId(string, optional): Bitwarden collection IDbitwardenItemId(string, optional): Bitwarden item IDonepasswordVaultId(string, optional): 1Password vault IDonepasswordItemId(string, optional): 1Password item IDazureVaultName(string, optional): Azure vault nameazureVaultUsernameKey(string, optional): Azure username keyazureVaultPasswordKey(string, optional): Azure password keyazureVaultTotpSecretKey(string, optional): Azure TOTP secret keyprompt(string, optional): Custom login instructionswebhookUrl(string, optional): Webhook notification URLproxyLocation(ProxyLocation, optional): Geographic proxy locationtotpIdentifier(string, optional): TOTP identifiertotpUrl(string, optional): TOTP URLbrowserSessionId(string, optional): Use existing browser sessionbrowserAddress(string, optional): Custom browser addressextraHttpHeaders(Record<string, string>, optional): Additional headerswaitForCompletion(boolean, optional): Wait for completion (default: false)timeout(number, optional): Timeout in seconds (default: 1800)
HttpResponsePromise<WorkflowRunResponse> with execution results
Download Files
Execute a file download workflow:navigationGoal(string, required): Instructions for navigating to and downloading the fileurl(string, optional): Starting URLdownloadSuffix(string, optional): Suffix or filename for downloaded filedownloadTimeout(number, optional): Timeout in seconds for downloadmaxStepsPerRun(number, optional): Maximum steps to executewebhookUrl(string, optional): Webhook notification URLtotpIdentifier(string, optional): TOTP identifiertotpUrl(string, optional): TOTP URLbrowserSessionId(string, optional): Use existing browser sessionbrowserAddress(string, optional): Custom browser addressextraHttpHeaders(Record<string, string>, optional): Additional headerswaitForCompletion(boolean, optional): Wait for completion (default: false)timeout(number, optional): Timeout in seconds (default: 1800)
HttpResponsePromise<WorkflowRunResponse> with execution results
Resource Management
Close Resources
Close all browsers and release resources:Properties
environment
Get the current Skyvern environment:Complete Example
See Also
- AI Commands - Learn about AI-powered page methods
- Browser Automation - Mix Playwright with AI
- Authentication - API keys and credential management
- Python SDK - Python SDK reference