Skip to content

Commit 2b8bae2

Browse files
Merge branch 'development6' of github.com:joaopauloschuler/beyond-python-smolagents into development6
2 parents 35f66cf + 5b127c6 commit 2b8bae2

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

bp-examples/scripts/run-agent-cycles.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
else:
4242
PLANNING_INTERVAL = 22
4343

44+
task_file_input = input("Enter task description file path (press Enter to use default task): ").strip()
45+
4446
POSTPEND_GEMINI_FLASH_VIA_POE = ''
4547
POSTPEND_GEMINI_FLASH_VIA_GOOGLE = ''
4648
POSTPEND_CLAUDE = ''
@@ -207,8 +209,20 @@
207209
</your-task>
208210
May the force be with you. I do trust your judgement."""
209211

212+
# Load task from file if provided, otherwise use DEFAULT_TASK
213+
task_description = DEFAULT_TASK
214+
if task_file_input:
215+
try:
216+
with open(task_file_input, 'r', encoding='utf-8') as f:
217+
task_description = f.read()
218+
print(f"Task description loaded from: {task_file_input}")
219+
except FileNotFoundError:
220+
print(f"Warning: File '{task_file_input}' not found. Using default task.")
221+
except Exception as e:
222+
print(f"Warning: Error reading file '{task_file_input}': {e}. Using default task.")
223+
210224
run_agent_cycles(model=model,
211-
task_str=DEFAULT_TASK,
225+
task_str=task_description,
212226
cycles_cnt=CYCLES_CNT,
213227
planning_interval=PLANNING_INTERVAL,
214-
max_steps=MAX_STEPS_PER_CYCLE)
228+
max_steps=MAX_STEPS_PER_CYCLE)

0 commit comments

Comments
 (0)