BedrockAgentCoreDataPlaneFrontingLayer / Client / start_browser_session

start_browser_session

BedrockAgentCoreDataPlaneFrontingLayer.Client.start_browser_session(**kwargs)

Creates and initializes a browser session in Amazon Bedrock. The session enables agents to navigate and interact with web content, extract information from websites, and perform web-based tasks as part of their response generation.

To create a session, you must specify a browser identifier and a name. You can also configure the viewport dimensions to control the visible area of web content. The session remains active until it times out or you explicitly stop it using the StopBrowserSession operation.

The following operations are related to StartBrowserSession:

See also: AWS API Documentation

Request Syntax

response = client.start_browser_session(
    browserIdentifier='string',
    name='string',
    sessionTimeoutSeconds=123,
    viewPort={
        'width': 123,
        'height': 123
    },
    clientToken='string'
)
Parameters:
  • browserIdentifier (string) –

    [REQUIRED]

    The unique identifier of the browser to use for this session. This identifier specifies which browser environment to initialize for the session.

  • name (string) – The name of the browser session. This name helps you identify and manage the session. The name does not need to be unique.

  • sessionTimeoutSeconds (integer) – The time in seconds after which the session automatically terminates if there is no activity. The default value is 3600 seconds (1 hour). The minimum allowed value is 60 seconds, and the maximum allowed value is 28800 seconds (8 hours).

  • viewPort (dict) –

    The dimensions of the browser viewport for this session. This determines the visible area of the web content and affects how web pages are rendered. If not specified, Amazon Bedrock uses a default viewport size.

    • width (integer) – [REQUIRED]

      The width of the viewport in pixels. This value determines the horizontal dimension of the visible area. Valid values range from 800 to 1920 pixels.

    • height (integer) – [REQUIRED]

      The height of the viewport in pixels. This value determines the vertical dimension of the visible area. Valid values range from 600 to 1080 pixels.

  • clientToken (string) –

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. This parameter helps prevent the creation of duplicate sessions if there are temporary network issues.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'browserIdentifier': 'string',
    'sessionId': 'string',
    'createdAt': datetime(2015, 1, 1),
    'streams': {
        'automationStream': {
            'streamEndpoint': 'string',
            'streamStatus': 'ENABLED'|'DISABLED'
        },
        'liveViewStream': {
            'streamEndpoint': 'string'
        }
    }
}

Response Structure

  • (dict) –

    • browserIdentifier (string) –

      The identifier of the browser.

    • sessionId (string) –

      The unique identifier of the created browser session.

    • createdAt (datetime) –

      The timestamp when the browser session was created.

    • streams (dict) –

      The streams associated with this browser session. These include the automation stream and live view stream.

      • automationStream (dict) –

        The stream that enables programmatic control of the browser. This stream allows agents to perform actions such as navigating to URLs, clicking elements, and filling forms.

        • streamEndpoint (string) –

          The endpoint URL for the automation stream. This URL is used to establish a WebSocket connection to the stream for sending commands and receiving responses.

        • streamStatus (string) –

          The current status of the automation stream. This indicates whether the stream is available for use. Possible values include ACTIVE, CONNECTING, and DISCONNECTED.

      • liveViewStream (dict) –

        The stream that provides a visual representation of the browser content. This stream allows agents to observe the current state of the browser, including rendered web pages and visual elements.

        • streamEndpoint (string) –

          The endpoint URL for the live view stream. This URL is used to establish a connection to receive visual updates from the browser session.

Exceptions