feat(ai): streaming agent loop (AI-037a)#326
Merged
Merged
Conversation
AgentLoop.StreamAsync yields an AgentEvent per step as it happens, then a terminal Done event with the final AgentResult; RunAsync is rebuilt on top (behaviour identical, budget exhaustion still throws with its transcript). StudyBuddyAgent.StreamAsync streams with the same config. The SSE endpoint + persistence + GET run are AI-037b. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mrviduus
added a commit
that referenced
this pull request
Jun 15, 2026
A scheduled health check landing inside the ~25-min deploy window saw the API container restarting (connection-refused / brief 5xx) and false-failed: the smoke checks used only '--retry 2' with no delay (~3s of retry). Unified all checks onto one retry policy (--retry 5 --retry-delay 15 --retry-all-errors --retry-connrefused, ~75s) so a deploy restart is ridden out instead of paging. Prod was verified healthy at fix time; the 00:10 failure was mid-deploy of #326. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 6 AI-037, slice a — the loop streams its steps so the reader can watch the agent work. The SSE endpoint + run persistence +
GET /me/studybuddy/runs/{id}are slice b.Changes
AgentLoop.StreamAsync— yields anAgentEventper step as it happens (llm_response/tool_result), then a terminal Done event carrying the finalAgentResult.RunAsyncis now built on top of it (consumes to the Done result), so non-streaming callers (the AI-039 eval) are unchanged: behaviour is identical, and budget exhaustion still throwsAgentBudgetExhaustedException(with its partial transcript) after the steps have streamed.AgentEvent(Ai.Agents) — a step-or-result union (OfStep/Done, exactly one non-null).StudyBuddyAgent.StreamAsync— same prompt / tools / $0.05 budget asRunAsync; both share oneBuildAgentInput.Verification
AgentLoop.StreamAsync: step events in order then a single terminal Done (last event); budget exhaustion streams the partial steps to the consumer then throws, with no Done event.StudyBuddyAgent.StreamAsync: config threading → step + Done.TextStack.UnitTests(270) green;dotnet formatclean.🤖 Generated with Claude Code