From 963f59569437fe43a49ce36a003a143fa2f767c8 Mon Sep 17 00:00:00 2001 From: Guillermo Serrahima Date: Fri, 26 Jun 2026 14:39:23 +0200 Subject: created custom agent loop --- agent/orchestrator/loop.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 agent/orchestrator/loop.py (limited to 'agent/orchestrator/loop.py') diff --git a/agent/orchestrator/loop.py b/agent/orchestrator/loop.py new file mode 100644 index 0000000..ed2c0a8 --- /dev/null +++ b/agent/orchestrator/loop.py @@ -0,0 +1,18 @@ +"""Per-turn orchestration. + +A turn is: gather dynamic context, hand the conversation to the backend, return +the response. As capabilities grow (memory recall, routing per intent, channel +adapters) they hang off this function. +""" + +from .context import build_turn_context +from .models import Message, ModelRequest, call_model + + +def handle_turn(messages: list[Message]) -> str: + request = ModelRequest( + messages=messages, + turn_context=build_turn_context(), + ) + response = call_model(request) + return response.content -- cgit v1.2.3