From 19b4c18b6930d8aaa1928fac727ce36409df3c4d Mon Sep 17 00:00:00 2001 From: Debanjum Date: Tue, 20 May 2025 01:03:11 -0700 Subject: [PATCH] Configure max iterations per operator run via environment variable --- src/khoj/processor/operator/operate_browser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/khoj/processor/operator/operate_browser.py b/src/khoj/processor/operator/operate_browser.py index b3f9fef4..f13fcdc3 100644 --- a/src/khoj/processor/operator/operate_browser.py +++ b/src/khoj/processor/operator/operate_browser.py @@ -1,6 +1,7 @@ import asyncio import json import logging +import os from typing import Callable, List, Optional import requests @@ -46,7 +47,7 @@ async def operate_browser( raise ValueError(f"No vision enabled chat model found. Configure a vision chat model to operate browser.") # Initialize Agent - max_iterations = 40 # TODO: Configurable? + max_iterations = int(os.getenv("KHOJ_OPERATOR_ITERATIONS", 40)) operator_agent: OperatorAgent if reasoning_model.name.startswith("gpt-4o"): operator_agent = OpenAIOperatorAgent(query, reasoning_model, max_iterations, tracer)