Skip to content

Feature Request: Support custom headers for CDP connect (enables AWS AgentCore Browser integration) #396

@pahud

Description

@pahud

Summary

Add support for custom headers when connecting to remote browsers via CDP (Chrome DevTools Protocol). This enables integration with authenticated browser services like AWS Bedrock AgentCore Browser that
require SigV4 signed headers.

Use Case

AWS Bedrock AgentCore Browser provides a managed, cloud-based browser for AI agents. It uses CDP for browser automation but requires AWS SigV4 authentication headers on the WebSocket connection:

# AWS SDK generates these headers
ws_url, headers = client.generate_ws_headers()
# headers contains: Authorization, X-Amz-Date, Host, etc.

# Playwright supports this:
browser = chromium.connect_over_cdp(ws_url, headers=headers)

Currently, agent-browser connect cannot pass these headers, making it incompatible with AgentCore Browser and similar authenticated services.

Proposed Solution

Add --headers flag to the connect command:

agent-browser connect "wss://bedrock-agentcore..." --headers '{"Authorization":"AWS4-HMAC-SHA256...", "X-Amz-Date":"..."}'

Technical Details

Playwright's connectOverCDP() already supports a headers option:

chromium.connectOverCDP(url, { headers: {...} })

The change requires:

  1. Accept --headers JSON in CLI
  2. Pass headers to connectOverCDP() in browser.ts

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions