feat(subturn): implement token budget tracking for SubTurns

This commit is contained in:
Administrator committed 2026-03-19 12:38:18 +08:00
1 parent 01c2f8d608
commit 99b189d3fb
4 files changed
+92 -10

No files matched your search

+4
View File
@@ -1460,6 +1460,10 @@ func (al *AgentLoop) runLLMIteration(
// Save finishReason to turnState for SubTurn truncation detection
if ts := turnStateFromContext(ctx); ts != nil {
ts.SetLastFinishReason(response.FinishReason)
// Save usage for token budget tracking
if response.Usage != nil {
ts.SetLastUsage(response.Usage)
}
}
go al.handleReasoning(