Hi! We are getting this following error on our age...
# agents
a
Hi! We are getting this following error on our agents. They seem really at random, seems to work pretty fine in most cases and i wanted to know if you have encounter something similar or maybe its a known bug in tasks. Anything helps.
Copy code
Error running task NegotiationTask: cannot call `SpeechHandle.wait_for_playout()` from inside the function tool `avanzar_flujo` that owns this SpeechHandle. This creates a circular wait: the speech handle is waiting for the function tool to complete, while the function tool is simultaneously waiting for the speech handle.
r
How are you awaiting the playing in your tool call
a
Copy code
result: NegotiationResult = await NegotiationTask(...)
this is inside a function that the tool calls, not the tool itself if that helps
We also just added this to the task to prohibit the agent to say certain words (it was enunciating function calls)
Copy code
async def llm_node(  
            self,  
            chat_ctx: llm.ChatContext,  
            tools: list[FunctionTool],  
            model_settings: ModelSettings,  
        ):  
        
            
            # Obtener el stream del LLM por defecto  
            llm_stream = Agent.default.llm_node(self, chat_ctx, tools, model_settings)  
            if asyncio.iscoroutine(llm_stream):  
                llm_stream = await llm_stream  
            
            accumulated_text = ""  
            
            async for chunk in llm_stream:  
                if isinstance(chunk, str):  
                    accumulated_text += chunk  
                elif isinstance(chunk, llm.ChatChunk):  
                    if chunk.delta and chunk.delta.content:  
                        accumulated_text += chunk.delta.content  

                # Verificar palabras prohibidas  
                if self._contains_forbidden_word(accumulated_text):  
                     ...
I was also thinking that that await in the llm stream was causing issues since i did not know what other await might be causing this
I was expecting you to have a
SpeechHandle.wait_for_playout()
somewhere
a
nope