Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define browser manager API #1497

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

satansdeer
Copy link
Contributor

@satansdeer satansdeer commented Jan 6, 2025

Depends on: #1495 (db migration)

  • Define persistent browser sessions manager
  • Add db methods
  • Add testing helper

Testing

python scripts/test_persistent_browsers.py

The testing helper provides HTTP API and direct method call commands:

Browser Sessions Testing CLI
Type 'help' for available commands

> help

HTTP API Commands:
  list - List all active browser sessions
  create - Create a new browser session
  get <session_id> - Get details of a specific session
  close <session_id> - Close a specific session
  close_all - Close all active browser sessions
  help - Show this help message

Direct Method Commands:
  direct_list <org_id> - List sessions directly
  direct_network <session_id> - Get network info directly
  help_direct - Show direct command help

Other Commands:
  exit - Exit the program

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to f19e60e in 1 minute and 45 seconds

More details
  • Looked at 658 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. skyvern/forge/sdk/db/client.py:2293
  • Draft comment:
    Remove the print statement used for debugging purposes. Consider using proper logging instead.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The create_persistent_browser_session method in AgentDB has a print statement that seems to be used for debugging purposes. This should be removed or replaced with proper logging to maintain clean and professional code.
2. skyvern/webeye/persistent_sessions_manager.py:62
  • Draft comment:
    Remove the print statement used for debugging purposes. Consider using proper logging instead.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The create_session method in PersistentSessionsManager has a print statement that seems to be used for debugging purposes. This should be removed or replaced with proper logging to maintain clean and professional code.
3. scripts/test_persistent_browsers.py:8
  • Draft comment:
    Consider adding a check to ensure API_KEY is not None after retrieval from the environment. This will help avoid issues if the environment variable is not set.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In test_persistent_browsers.py, the API_KEY is retrieved from the environment but not checked for None. This could lead to issues if the environment variable is not set. It's a good practice to handle such cases.

Workflow ID: wflow_O6uQXZpwqX26pgM4


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@satansdeer satansdeer force-pushed the maksimi/browser-manager-api branch from 1679678 to 9c2e551 Compare January 6, 2025 14:50
from skyvern.forge.sdk.schemas.persistent_browser_sessions import PersistentBrowserSession


class BrowserSessionResponse(BaseModel):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[not a block] nit picky:
we can reuse the PersistentBrowserSession pydantic model. https://chatgpt.com/share/677e032d-f414-800b-8914-3785008cba3b

@@ -161,20 +161,26 @@ def update_chromium_browser_preferences(user_data_dir: str, download_dir: str) -
f.write(preference_file_content)

@staticmethod
def build_browser_args(proxy_location: ProxyLocation | None = None) -> dict[str, Any]:
def build_browser_args(proxy_location: ProxyLocation | None = None, **kwargs: dict) -> dict[str, Any]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LawyZheng pls also take a look at this part

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants