You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/best-practices/deployments.mdx
+25-47Lines changed: 25 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,11 +11,6 @@ description: 'Deploy your AI agents and automations to the cloud'
11
11
12
12
Securely run Stagehand on Browserbase inside a Vercel Function. This guide shows a minimal, production-safe HTTP endpoint you can call directly or on a schedule.
13
13
14
-
### Short answer
15
-
-**Wrap your script as a Vercel Function** (no Next.js needed)
16
-
-**Set environment variables**
17
-
-**Deploy with Vercel**
18
-
19
14
### 1. Install Vercel CLI
20
15
21
16
To download and install Vercel CLI, run one of the following commands:
Increase `maxDuration` as your plan allows. See Vercel's docs for up-to-date limits. Edge runtime may allow longer limits on Pro/Enterprise with Fluid compute.
149
+
See Vercel's [configuring functions](https://vercel.com/docs/functions/configuring-functions) docs for more details.
160
150
161
151
### 7. Link your project
162
152
@@ -168,9 +158,6 @@ vercel login
168
158
169
159
# link the current directory to a Vercel project (interactive)
170
160
vercel link
171
-
172
-
# or non-interactive if you know the project
173
-
# vercel link --project <PROJECT_NAME_OR_ID> --yes
174
161
```
175
162
176
163
### 8. Environment variables
@@ -186,7 +173,7 @@ vercel env add GOOGLE_API_KEY
186
173
187
174
See also: [Browser Environment](/configuration/environment) for details on required variables.
188
175
189
-
### Test locally (optional)
176
+
### 9. Test locally
190
177
191
178
Replicate the Vercel environment locally to exercise your Function before deploying. Run from the project root.
192
179
@@ -195,29 +182,17 @@ Replicate the Vercel environment locally to exercise your Function before deploy
195
182
npm install
196
183
197
184
# start the local Vercel dev server
198
-
vercel dev
199
-
```
200
-
201
-
Useful options:
202
-
203
-
```bash
204
-
# specify port
205
185
vercel dev --listen 5005
206
-
207
-
# skip interactive setup prompts
208
-
vercel dev --yes
209
186
```
210
187
211
-
If your framework's dev server already supports Functions (e.g., `next dev` for Next.js), prefer that. For this non-framework "Other" project, `vercel dev` is recommended.
212
-
213
-
### 9. Deploy
188
+
### 10. Deploy
214
189
215
190
```bash
216
191
vercel
217
192
vercel --prod
218
193
```
219
194
220
-
### 10. Call it
195
+
### Execute the function
221
196
222
197
```bash
223
198
curl -X POST https://<your-deployment>/api/run
@@ -231,16 +206,19 @@ Hit the same endpoint on a schedule by extending `vercel.json`:
0 commit comments