@@ -62,40 +62,67 @@ await stagehand.agent.execute("book a reservation for 2 people for a trip to the
62
62
63
63
## Installation
64
64
65
- Install the Python package via pip:
65
+ ** Recommended:** Install using ` uv ` (fast Python package manager):
66
+
67
+ ``` bash
68
+ uv add stagehand
69
+ ```
70
+
71
+ Alternatively, install via pip:
66
72
67
73
``` bash
68
74
pip install stagehand
69
75
```
76
+
77
+ ### Installing with uv
78
+
79
+ [ uv] ( https://github.com/astral-sh/uv ) is a fast Python package installer and resolver. If you don't have uv installed, you can install it with:
80
+
81
+ ``` bash
82
+ # On macOS and Linux
83
+ curl -LsSf https://astral.sh/uv/install.sh | sh
84
+
85
+ # On Windows
86
+ powershell -c " irm https://astral.sh/uv/install.ps1 | iex"
87
+
88
+ # Or via pip
89
+ pip install uv
90
+ ```
91
+
92
+ For new projects, you can create a new project with uv:
93
+
94
+ ``` bash
95
+ uv init stagehand-project
96
+ cd stagehand-project
97
+ uv add stagehand
98
+ ```
99
+
70
100
## Requirements
71
101
72
102
- Python 3.9+
73
- - httpx (for async client)
74
- - requests (for sync client)
75
- - asyncio (for async client)
76
- - pydantic
77
- - python-dotenv (optional, for .env support)
78
- - playwright
79
- - rich (for ` examples/ ` terminal support)
103
+ - All dependencies are automatically handled when installing via ` uv ` or ` pip `
80
104
81
- You can simply run:
105
+ The main dependencies include:
106
+ - httpx (for async HTTP client)
107
+ - requests (for sync HTTP client)
108
+ - pydantic (for data validation)
109
+ - playwright (for browser automation)
110
+ - python-dotenv (for environment variable support)
111
+ - browserbase (for Browserbase integration)
112
+
113
+ ### Development Dependencies
114
+
115
+ For development, install with dev dependencies:
82
116
83
117
``` bash
84
- pip install -r requirements.txt
118
+ uv add stagehand --dev
85
119
```
86
120
87
- ** requirements.txt**
88
- ``` txt
89
- httpx>=0.24.0
90
- asyncio>=3.4.3
91
- python-dotenv>=1.0.0
92
- pydantic>=1.10.0
93
- playwright>=1.42.1
94
- requests>=2.31.0
95
- rich
96
- browserbase
97
- ```
121
+ Or install dev dependencies separately:
98
122
123
+ ``` bash
124
+ uv add --dev pytest pytest-asyncio pytest-mock pytest-cov black isort mypy ruff rich
125
+ ```
99
126
100
127
## Environment Variables
101
128
@@ -106,6 +133,7 @@ export BROWSERBASE_API_KEY="your-api-key"
106
133
export BROWSERBASE_PROJECT_ID=" your-project-id"
107
134
export MODEL_API_KEY=" your-openai-api-key" # or your preferred model's API key
108
135
export STAGEHAND_API_URL=" url-of-stagehand-server"
136
+ export STAGEHAND_ENV=" BROWSERBASE" # or "LOCAL" to run Stagehand locally
109
137
```
110
138
111
139
You can also make a copy of ` .env.example ` and add these to your ` .env ` file.
0 commit comments