Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion agent_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ def agent_runner_loop(client, system_prompt, user_input, handler, tools_schema,
{"role": "user", "content": initial_user_content if initial_user_content is not None else user_input}
]
turn = 0; handler.max_turns = max_turns
_hook('agent_before', locals())
result = _hook('agent_before', locals())
if isinstance(result, dict):
# Hook 可能修改了 locals,需要更新变量
if 'system_prompt' in result:
messages[0]['content'] = result['system_prompt']
while turn < handler.max_turns:
turn += 1; turnstr = f'LLM Running (Turn {turn}) ...'
if handler.parent.task_dir: turnstr = f'Turn {turn} ...'
Expand Down