Skip to content

The agent that turns websites into APIs!

fix: move browser-use to optional dependencies for PyPI compatibility

kalil032121bd96cc5776
diff --git a/README.md b/README.md
index 6a7a470..6fa5bc8 100644
--- a/README.md
+++ b/README.md
@@ -35,12 +35,20 @@ CLI tool that captures browser traffic and automatically generates production-re
### Using pip
```bash
+# Basic installation (manual and engineer modes)
pip install reverse-api-engineer
+
+# With agent mode support (includes browser-use)
+pip install 'reverse-api-engineer[agent]'
```
### Using uv (recommended)
```bash
+# Basic installation
uv tool install reverse-api-engineer
+
+# With agent mode support
+uv tool install 'reverse-api-engineer[agent]'
```
### From source
@@ -96,13 +104,19 @@ reverse-api-engineer engineer <run_id>
Fully automated browser interaction using AI agents:
-1. Start the CLI: `reverse-api-engineer`
-2. Switch to agent mode (Shift+Tab until you see `[agent]`)
-3. Enter your task description (e.g., "Click on the first job listing")
-4. Optionally provide a starting URL
-5. The agent automatically navigates and interacts with the website
-6. HAR is captured automatically
-7. Optionally run reverse engineering to generate API client
+1. Install with agent support: `pip install 'reverse-api-engineer[agent]'` or `uv tool install 'reverse-api-engineer[agent]'`
+2. Start the CLI: `reverse-api-engineer`
+3. Switch to agent mode (Shift+Tab until you see `[agent]`)
+4. Enter your task description (e.g., "Click on the first job listing")
+5. Optionally provide a starting URL
+6. The agent automatically navigates and interacts with the website
+7. HAR is captured automatically
+8. Optionally run reverse engineering to generate API client
+
+**Note:** If you need a specific version of browser-use from git, install it separately:
+```bash
+pip install git+https://github.com/browser-use/browser-use.git@<commit-hash>
+```
**Agent Model Configuration:**
- **Browser-Use LLM** (default): Requires `BROWSER_USE_API_KEY`
diff --git a/RELEASE.md b/RELEASE.md
new file mode 100644
index 0000000..88f3c9b
--- /dev/null
+++ b/RELEASE.md
@@ -0,0 +1,101 @@
+# Release v0.2.0 - Instructions
+
+## ✅ Completed Steps
+
+1. ✅ Updated version to 0.2.0 in `pyproject.toml`
+2. ✅ Updated version to 0.2.0 in `src/reverse_api/__init__.py`
+3. ✅ Created `CHANGELOG.md` with release notes
+4. ✅ Created git commit with version bump
+5. ✅ Created git tag `v0.2.0`
+
+## 📦 Next Steps
+
+### 1. Push to GitHub
+
+```bash
+# Push the commit and tag to GitHub
+git push origin feat/browser-agent
+git push origin v0.2.0
+
+# Or if you want to merge to main first:
+# git checkout main
+# git merge feat/browser-agent
+# git push origin main
+# git push origin v0.2.0
+```
+
+### 2. Create GitHub Release
+
+1. Go to: https://github.com/kalil0321/reverse-api-engineer/releases/new
+2. Select tag: `v0.2.0`
+3. Release title: `v0.2.0 - OpenCode Support, Agent Mode & UX Improvements`
+4. Description (copy from CHANGELOG.md):
+
+```markdown
+## [0.2.0] - 2024-12-XX
+
+### Added
+- **OpenCode SDK Support**: Native integration with OpenCode SDK for more flexibility in reverse engineering workflows
+- **Agent Mode**: Fully automated browser interaction using AI agents (browser-use) with support for multiple LLM providers
+ - Browser-Use LLM (default)
+ - OpenAI models (gpt-4, gpt-3.5-turbo, etc.)
+ - Google models (gemini-pro, gemini-1.5-pro, etc.)
+- **Multi-Provider Agent Support**: Configure agent models via settings with automatic API key detection
+
+### Changed
+- Improved UX with better CLI interactions and mode cycling
+- Enhanced settings management for model, agent model, SDK, and output directory configuration
+- Better error handling and user feedback throughout the application
+
+### Fixed
+- Various bug fixes and improvements based on user feedback
+```
+
+5. Click "Publish release"
+
+### 3. Build and Publish to PyPI
+
+```bash
+# Make sure you're in the project root
+cd /Users/kalilbouzigues/Projects/browgents/reverse-api
+
+# Clean previous builds
+rm -rf dist/ build/ *.egg-info
+
+# Build the package
+uv build
+
+# Verify the build
+ls -lh dist/
+
+# Upload to PyPI (requires PyPI credentials)
+# Option 1: Using twine (recommended)
+pip install twine
+twine upload dist/*
+
+# Option 2: Using uv
+uv publish
+
+# You'll be prompted for PyPI credentials
+# Username: __token__
+# Password: your-pypi-api-token
+```
+
+### 4. Verify Release
+
+After publishing:
+
+1. **PyPI**: Check https://pypi.org/project/reverse-api-engineer/
+2. **GitHub**: Check https://github.com/kalil0321/reverse-api-engineer/releases
+3. **Test installation**:
+ ```bash
+ pip install --upgrade reverse-api-engineer
+ reverse-api-engineer --version # Should show 0.2.0
+ ```
+
+## 📝 Notes
+
+- Make sure you have PyPI API token ready (create at https://pypi.org/manage/account/token/)
+- The tag `v0.2.0` has been created locally and needs to be pushed
+- Consider merging `feat/browser-agent` branch to `main` before creating the release
+
diff --git a/prompts.md b/prompts.md
new file mode 100644
index 0000000..a9a985a
--- /dev/null
+++ b/prompts.md
@@ -0,0 +1,24 @@
+! error: asyncio.run() cannot be called from a running event loop
+! error: asyncio.run() cannot be called from a running event loop
+
+
+-----------------------------------
+
+please now i want you to implement the agent mode. It's similar to the manual but the browser is now controlled by a browser agent. The browser agent can be browser-use or stagehand (can be modified in settings). First we will implement with browser-use.
+
+https://docs.browser-use.com/customize/code-agent/basics
+
+https://docs.browser-use.com/customize/agent/basics
+
+
+
+We don't care much about the agent activity.
+
+-----
+
+f64cedb09866
+
+bu-version: 038ae4bc8d1ace0d0063544b37b08933086d3bf3
+
+go on map.stapply.ai/jobs/browserbase and click the apply button
+
diff --git a/pyproject.toml b/pyproject.toml
index 24fc971..25c4bf9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -30,10 +30,14 @@ dependencies = [
"requests>=2.32.5",
"anthropic>=0.40.0",
"brotli>=1.2.0",
- "browser-use @ git+https://github.com/browser-use/browser-use.git@1a96cf7ef00bfbb6e21978f77e347639c316fff8",
"aiohttp>=3.12.15",
]
+[project.optional-dependencies]
+agent = [
+ "browser-use",
+]
+
[project.urls]
Homepage = "https://github.com/kalil0321/reverse-api-engineer"
Repository = "https://github.com/kalil0321/reverse-api-engineer"
diff --git a/src/reverse_api/browser.py b/src/reverse_api/browser.py
index 4a5663a..cff2bf5 100644
--- a/src/reverse_api/browser.py
+++ b/src/reverse_api/browser.py
@@ -611,8 +611,17 @@ class AgentBrowser:
logger.addHandler(null_handler)
logger.propagate = False
- from browser_use import Agent, Browser
- from browser_use import ChatBrowserUse
+ try:
+ from browser_use import Agent, Browser
+ from browser_use import ChatBrowserUse
+ except ImportError:
+ result = {
+ "success": False,
+ "message": None,
+ "error": "browser-use is required for agent mode. Install it with: pip install 'reverse-api-engineer[agent]' or pip install browser-use",
+ }
+ console.print(f" [red]error:[/red] {result['error']}")
+ return result
result = {"success": False, "message": None, "error": None}
browser = None