feat(beta/tools): add speak_to_ivr tool auto-injected with ivr_detection#5399
Open
ibiscp wants to merge 1 commit intolivekit:mainfrom
Open
feat(beta/tools): add speak_to_ivr tool auto-injected with ivr_detection#5399ibiscp wants to merge 1 commit intolivekit:mainfrom
ibiscp wants to merge 1 commit intolivekit:mainfrom
Conversation
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.
Problem
ivr_detection=Trueautomatically injectssend_dtmf_eventsfor key presses, but provides no equivalent for verbal responses. IVR systems use both modalities: pressing digits and saying phrases ("say your name", "say yes or no", "say your account number"). Without a built-in tool, every developer building an IVR agent must implement the same boilerplate:And then instruct the agent via system prompt to always call it after every verbal response. This is the same class of problem as the missing
StopResponseinsend_dtmf_events— the tool exists conceptually but the correct behavior isn't encoded by default.Fix
Add
speak_to_ivras a built-infunction_toolinbeta/tools/and auto-inject it alongsidesend_dtmf_eventsviaIVRActivity.tools. The tool callssession.say()withallow_interruptions=False(appropriate for IVR contexts where the agent must finish speaking before the IVR processes the response), waits for playout, and raisesStopResponse()to yield the turn back to the IVR.send_dtmf_eventsandspeak_to_ivrare symmetric IVR interaction primitives — key presses and verbal responses. Both should be available out of the box whenivr_detection=True.Impact
speak_to_ivris additive.ivr_detection=Truewill now havespeak_to_ivravailable automatically. Agents that already define their own equivalent tool should remove it to avoid duplication.