Agent actions and gral function. Need agent classes to separate advanced agent functionality.

This commit is contained in:
Shivering Ocelot committed 2025-05-27 23:51:28 -05:00
1 parent c3e55e89f2
commit 9a8e68f021
8 files changed
+222 -53

No files matched your search

+11 -1
View File
@@ -59,11 +59,17 @@ def start_server(app):
await send_queue.put(msg)
try:
app.add_user_connection(user_id, send_queue)
if 'remotename' in auth_req:
app.add_remote_connection(user_id, authreq['remotename'], authreq['tools'], send_queue)
else:
app.add_user_connection(user_id, send_queue)
asyncio.create_task(sender_task())
while True:
req = json.loads(await websocket.receive())
if not 'action' in req:
await send({'error': 'no action'})
continue
action = req['action']
body = req.get('body', {})
nonce = req.get('nonce', None)
@@ -140,6 +146,10 @@ def start_server(app):
response = await app.send_agent_prompt(body['agentId'], body['content'])
await send({'message': "propmt sent", 'response': response, 'nonce': nonce})
elif action == "call-agent-action":
result = await app.call_agent_action(body['agentId'], body['agentAction'], body['arguments'])
await send({'message': "agent action executed", 'result': result, 'nonce': nonce})
else:
await send({'error': 'unknown action: ' + action, 'nonce': nonce})
finally: