simoncck commited on
Commit
319a220
·
verified ·
1 Parent(s): afe2777

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
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 = make_llm()
58
- agent = Agent(
59
- task=t.task,
60
- llm=llm,
61
- max_steps=int(os.getenv("AGENT_MAX_STEPS", 6)),
62
- step_delay=float(os.getenv("AGENT_STEP_DELAY", 2.0)),
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))