Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,14 +54,12 @@ def make_llm():
|
|
| 54 |
@app.post("/run")
|
| 55 |
async def run_task(t: Task):
|
| 56 |
try:
|
| 57 |
-
llm
|
| 58 |
-
agent = Agent(
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
result = await agent.run_async() # async version
|
| 65 |
-
return result # Browser-Use returns dict
|
| 66 |
except Exception as e:
|
| 67 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
|
| 54 |
@app.post("/run")
|
| 55 |
async def run_task(t: Task):
|
| 56 |
try:
|
| 57 |
+
llm = make_llm()
|
| 58 |
+
agent = Agent(task=t.task, llm=llm) # ← constructor has no max_steps
|
| 59 |
+
|
| 60 |
+
# pick limits from env (or fall back to sane defaults)
|
| 61 |
+
max_steps = int(os.getenv("AGENT_MAX_STEPS", 10))
|
| 62 |
+
result = await agent.run_async(max_steps=max_steps) # ← here!
|
| 63 |
+
return result # Browser-Use returns dict
|
|
|
|
|
|
|
| 64 |
except Exception as e:
|
| 65 |
raise HTTPException(status_code=500, detail=str(e))
|