|
|
@@ -40,8 +40,6 @@ def read_task_from_stdin() -> str:
|
|
|
async def run_controller(
|
|
|
config: AppConfig,
|
|
|
task_str: str,
|
|
|
- max_iterations: int | None = None,
|
|
|
- max_budget_per_task: float | None = None,
|
|
|
exit_on_message: bool = False,
|
|
|
fake_user_response_fn: Callable[[State | None], str] | None = None,
|
|
|
sandbox: Sandbox | None = None,
|
|
|
@@ -56,8 +54,6 @@ async def run_controller(
|
|
|
Args:
|
|
|
config: The app config.
|
|
|
task_str: The task to run.
|
|
|
- max_iterations: The maximum number of iterations to run.
|
|
|
- max_budget_per_task: The maximum budget per task.
|
|
|
exit_on_message: quit if agent asks for a message from user (optional)
|
|
|
fake_user_response_fn: An optional function that receives the current state (could be None) and returns a fake user response.
|
|
|
sandbox: (will be deprecated) An optional sandbox to run the agent in.
|
|
|
@@ -72,7 +68,6 @@ async def run_controller(
|
|
|
agent = agent_cls(
|
|
|
llm=LLM(config=config.get_llm_config_from_agent(config.default_agent))
|
|
|
)
|
|
|
- max_iterations = max_iterations or config.max_iterations
|
|
|
|
|
|
# Logging
|
|
|
logger.info(
|
|
|
@@ -96,8 +91,8 @@ async def run_controller(
|
|
|
# init controller with this initial state
|
|
|
controller = AgentController(
|
|
|
agent=agent,
|
|
|
- max_iterations=max_iterations,
|
|
|
- max_budget_per_task=max_budget_per_task,
|
|
|
+ max_iterations=config.max_iterations,
|
|
|
+ max_budget_per_task=config.max_budget_per_task,
|
|
|
agent_to_llm_config=config.get_agent_to_llm_config_map(),
|
|
|
event_stream=event_stream,
|
|
|
initial_state=initial_state,
|
|
|
@@ -212,17 +207,14 @@ if __name__ == '__main__':
|
|
|
config.default_agent = args.agent_cls
|
|
|
|
|
|
# if max budget per task is not sent on the command line, use the config value
|
|
|
- max_budget_per_task = (
|
|
|
- args.max_budget_per_task
|
|
|
- if args.max_budget_per_task
|
|
|
- else config.max_budget_per_task
|
|
|
- )
|
|
|
+ if args.max_budget_per_task is not None:
|
|
|
+ config.max_budget_per_task = args.max_budget_per_task
|
|
|
+ if args.max_iterations is not None:
|
|
|
+ config.max_iterations = args.max_iterations
|
|
|
|
|
|
asyncio.run(
|
|
|
run_controller(
|
|
|
config=config,
|
|
|
task_str=task_str,
|
|
|
- max_iterations=args.max_iterations,
|
|
|
- max_budget_per_task=args.max_budget_per_task,
|
|
|
)
|
|
|
)
|