feat: added a chance for the LLM to stop execution

This commit is contained in:
Daniel Eder 2025-09-29 06:47:41 +02:00
parent f95b824a94
commit c807d8a6b3

View file

@ -148,6 +148,11 @@ class IntelligentAgent(Agent):
print(f"[Agent] Sent command: {value}")
self.history.append({"role": "assistant", "content": f"COMMAND {value}"})
self._trim_history()
elif action_type == "end":
print(f"[Agent] Execution ended by LLM.")
self.history.append({"role": "assistant", "content": f"END"})
self._trim_history()
stop_event.set()
else:
print(f"[Agent] Unknown action type '{action_type}'", file=sys.stderr)
return
@ -175,7 +180,7 @@ class IntelligentAgent(Agent):
"role": "system",
"content": (
"Respond with JSON only. Schema: {\n"
" \"type\": \"tool\" or \"command\",\n"
" \"type\": \"tool\" or \"command\" or \"end\",\n"
" \"value\": string,\n"
" \"notes\": optional string\n}"""
),