Skip to main content

Function: runAssistantLoop()

runAssistantLoop(request, providers, executor, budget, opts?): AsyncIterable<AssistantEvent>

Defined in: src/server/ai/chat/orchestrator.ts:134

Drive the full multi-round dialogue. request.messages is treated as immutable; a working copy grows with each assistant + tool message so subsequent model turns see the tool results. opts.now is injectable for deterministic wall-clock tests (defaults to Date.now).

Parameters

request

ChatRequest

providers

readonly ChatProvider[]

executor

ToolExecutor

budget

TurnBudget

opts?

now?

() => number

Returns

AsyncIterable<AssistantEvent>