2025-05-13 16:06:13 -07:00
from pydantic import BaseModel , Field
2025-12-04 12:04:38 -05:00
from skyvern . client . types . workflow_definition_yaml_blocks_item import WorkflowDefinitionYamlBlocksItem
from skyvern . client . types . workflow_definition_yaml_parameters_item import WorkflowDefinitionYamlParametersItem_Workflow
2026-01-07 15:39:53 +08:00
from skyvern . forge . sdk . schemas . persistent_browser_sessions import Extensions , PersistentBrowserType
2025-09-18 17:21:46 +08:00
from skyvern . schemas . docs . doc_strings import PROXY_LOCATION_DOC_STRING
from skyvern . schemas . runs import ProxyLocation
2025-05-13 16:06:13 -07:00
MIN_TIMEOUT = 5
2025-09-30 07:53:26 -07:00
MAX_TIMEOUT = 60 * 24 # 24 hours
2025-05-13 16:06:13 -07:00
DEFAULT_TIMEOUT = 60
class CreateBrowserSessionRequest ( BaseModel ) :
2025-05-14 18:20:56 -07:00
timeout : int | None = Field (
2025-05-13 16:06:13 -07:00
default = DEFAULT_TIMEOUT ,
description = f " Timeout in minutes for the session. Timeout is applied after the session is started. Must be between { MIN_TIMEOUT } and { MAX_TIMEOUT } . Defaults to { DEFAULT_TIMEOUT } . " ,
ge = MIN_TIMEOUT ,
le = MAX_TIMEOUT ,
)
2025-09-18 17:21:46 +08:00
proxy_location : ProxyLocation | None = Field (
default = None ,
description = PROXY_LOCATION_DOC_STRING ,
)
2025-12-04 12:04:38 -05:00
2025-12-24 13:01:52 +08:00
extensions : list [ Extensions ] | None = Field (
default = None ,
description = " A list of extensions to install in the browser session. " ,
)
2026-01-07 15:39:53 +08:00
browser_type : PersistentBrowserType | None = Field (
default = None ,
description = " The type of browser to use for the session. " ,
)
2025-12-04 12:04:38 -05:00
class ProcessBrowserSessionRecordingRequest ( BaseModel ) :
compressed_chunks : list [ str ] = Field (
default = [ ] ,
description = " List of base64 encoded and compressed (gzip) event strings representing the browser session recording. " ,
)
workflow_permanent_id : str = Field (
default = " no-such-wpid " ,
description = " Permanent ID of the workflow associated with the browser session recording. " ,
)
class ProcessBrowserSessionRecordingResponse ( BaseModel ) :
blocks : list [ WorkflowDefinitionYamlBlocksItem ] = Field (
default = [ ] ,
description = " List of workflow blocks generated from the processed browser session recording. " ,
)
parameters : list [ WorkflowDefinitionYamlParametersItem_Workflow ] = Field (
default = [ ] ,
description = " List of workflow parameters generated from the processed browser session recording. " ,
)