aboutsummaryrefslogtreecommitdiff
path: root/agent/orchestrator/loop.py
blob: ed2c0a803dbbf80520234d6d2483020a01b32d34 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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