Repository navigation
Keep a cascaded reply's tool calls and results in the conversation - #276
Merged
MikeAlhayek merged 3 commits intoOct 19, 2026
Merged
Conversation
A cascaded realtime session kept only the text of each reply in its history. The tool calls the chat leg made for the reply, and their results, were dropped, so the next turn was written without them: - a booking lost the slots it had found between turns; - a model that saw an answer it had no record of checking took it back. On a CrestApps.OrchardCore browser session with claude-haiku-5-5 as the chat leg, the reply after a correct availability answer (backed by two tool calls) was "I didn't actually check our booking calendar, so the afternoon times I mentioned for Tuesday weren't confirmed." The session now keeps everything the chat leg returned for a reply (the tool calls, their results, then the text) as the reply's messages, in order. A reply interrupted between asking for a tool and getting its answer leaves a call with no result; providers that pair each call with its result (Anthropic among them) refuse such a conversation, so that call is left out. An out-of-band reply still stays out of the history. Tests: Session_KeepsTheToolCallsAndTheirResultsInHistoryForTheNextTurn and Session_LeavesOutAToolCallTheInterruptionLeftUnanswered (the fake chat client can now emit any update, and hold only its first reply). Realtime tests 189/189.
Contributor
|
This pull request has merge conflicts. Please resolve those before requesting a review. |
Keeps both cascade changelog entries after CrestApps#277.
Contributor
|
This pull request has merge conflicts. Please resolve those before requesting a review. |
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.
Fixes #274
A cascaded realtime session now keeps a reply's tool calls and their results in its history, with the reply's text,
so the next turn knows what was looked up.
Changes
CascadedRealtimeSession.RunTurnAsynckeeps every update the chat leg streams for a reply, and adds the reply'smessages to the history in place of its text alone: the tool calls, their results, then the text.
so does what was looked up for it.
ExcludeFromConversationstill stays out of the history.answer leaves a
FunctionCallContentwith noFunctionResultContent. Providers that pair each call with its result(Anthropic among them) refuse a conversation holding one.
core/realtime-voice.md, the chat leg: what the history keeps;Tests
In
CascadedRealtimeSessionTests:Session_KeepsTheToolCallsAndTheirResultsInHistoryForTheNextTurn: the second turn's request holds the call andits result, in order, before the answer built on them.
Session_LeavesOutAToolCallTheInterruptionLeftUnanswered: a reply interrupted after its call leaves noFunctionCallContentin the next request.The fake chat client can now emit any update, and can hold only its first reply. The existing tests use it as before.
On our fork, the realtime tests pass (189), and so does the full test project, except the 2 known failures under a
Greek locale (
EmbeddedResourceAIProfileTemplateProviderTests,OpenXmlIngestionDocumentReaderTests), which failthe same way without this change.
Verified on a live call
The call ran through CrestApps.OrchardCore's voice agent on Telnyx, on a cascade of Deepgram
nova-3,claude-haiku-5-5and ElevenLabseleven_flash_v2_5, with a booking profile.booking calendar").
listCalendarsandgetAvailableSlots, then a choice of dates.bookAppointmentran, and the booking was confirmed.🤖 Generated with Claude Code