eigent
eigent copied to clipboard
feat: browser_external_cdp
Description
What is the purpose of this pull request?
- [ ] Bug fix
- [ ] New Feature
- [ ] Documentation update
- [ ] Other
Need this camel pr https://github.com/camel-ai/camel/pull/3666/files
Clone Operation Overview
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor':'#ffffff', 'primaryBorderColor':'#cccccc', 'background':'#ffffff', 'mainBkg':'#ffffff', 'secondBkg':'#ffffff', 'tertiaryColor':'#ffffff'}}}%%
sequenceDiagram
participant P as Parent Agent (ListenChatAgent)
participant M as CDP Manager (_cdp_pool_manager)
participant TK as Toolkit (HybridBrowserToolkit)
participant A as New Agent (Cloned)
Note over P: clone(with_memory=True/False)
P->>P: Generate Clone ID & unique Session ID
rect rgb(230, 240, 255)
Note right of P: CDP Pre-acquisition (If callback exists)
P->>M: acquire_browser(cdp_browsers, new_session_id)
M-->>P: Return Port (e.g., 9223)
P->>TK: Temporarily change CDP URL to localhost:9223
end
P->>P: _clone_tools() (Deep copy of tool definitions)
rect rgb(255, 240, 230)
Note right of P: Restore Parent State
P->>TK: Restore original CDP URL (e.g., localhost:9222)
end
P->>A: Instantiate ListenChatAgent with cloned tools
P->>A: Copy Metadata (task_id, callbacks, options)
Note over A: Post-Init Configuration
A->>A: find HybridBrowserToolkit in cloned tools
A->>A: Set _browser_toolkit & _cleanup_callback
alt with_memory is True
P->>P: memory.retrieve() (Get all records)
P->>A: memory.write_record() (Populate history)
end
P-->>User: Return New Agent