Skip to content

Commit 64c012c

Browse files
authored
Create command_executor.py
1 parent 8d65c0c commit 64c012c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

agents/tools/command_executor.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# tools/command_executor.py
2+
3+
def execute_commands(commands, db, config):
4+
for cmd in commands:
5+
print(f"🛠️ Выполнение команды: {cmd['type']} ({cmd.get('cmd_id')})")
6+
try:
7+
if cmd['type'] == 'shell':
8+
run_shell_command(cmd, db)
9+
elif cmd['type'] == 'diary_entry':
10+
db.write_entry(cmd['args']['text'], tags=["diary"])
11+
elif cmd['type'] == 'graph_add':
12+
db.add_link_or_concept(cmd['args'])
13+
elif cmd['type'] == 'llm_memory_add':
14+
db.add_llm_memory(cmd['args'])
15+
# ... остальные команды
16+
except Exception as e:
17+
db.log_error(cmd['cmd_id'], str(e))

0 commit comments

Comments
 (0)