Skip to content

API Authentication Issues with Agentic Browser #5

@ethanfox

Description

@ethanfox

Description

Currently experiencing consistent authentication failures when trying to connect Agentic Browser to Claude API. The configuration appears correct but results in 401 errors.

Current Behavior

  • API key is valid and works with direct API calls (verified via curl)
  • Browser launches and navigates successfully
  • Consistently receives "Failed to export batch code: 401, reason: unknown token" error
  • Steel Dev CDP connection fails (falls back to local browser)

Expected Behavior

  • Successful authentication with Claude API using valid API key
  • No 401 errors when configured correctly

Steps to Reproduce

  1. Configure environment with valid API key:
AGENTIC_BROWSER_TEXT_MODEL="claude-3-5-sonnet-20241022"
AGENTIC_BROWSER_TEXT_API_KEY="sk-ant-***"
AGENTIC_BROWSER_TEXT_BASE_URL="https://api.anthropic.com"
  1. Launch Agentic Browser
  2. Observe 401 authentication error in logs

Environment

  • Valid API key (verified working via curl)
  • Latest Claude model string: claude-3-5-sonnet-20241022
  • Correct base URL: https://api.anthropic.com

Logs

[2025-02-07 17:16:53,314] ERROR {__init__.py:172} - Failed to export batch code: 401, reason: unknown token

Verification Steps Taken

  1. Verified API key works directly with Anthropic API via curl
  2. Confirmed correct model string and base URL
  3. Tried both with and without "x-api-key:" prefix
  4. Browser successfully launches and navigates despite authentication failure

Questions

  1. Is there a specific format required for API key configuration beyond what's documented?
  2. Are there additional environment variables needed for authentication?
  3. Could there be a version mismatch between the authentication module and current Claude API requirements?

Suggested Next Steps

  1. Add detailed authentication debugging logs
  2. Document expected API key format and configuration
  3. Consider adding authentication verification step on startup
  4. Improve error messages to specify exact authentication failure reason

Additional Context

The API key works perfectly with direct API calls but fails specifically within Agentic Browser, suggesting a potential issue with how the authentication is being handled internally rather than an invalid key problem.

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