Skip to content

Realtime agent handoff to twilio closes twilio session and sends noise over phone #1632

@Eirikalb

Description

@Eirikalb

@rm-openai

Describe the bug

I tried modifying the demo in /examples/realtime/twilio to support multiple agent to have more complex behaviour. The first agent works fine, and the handoff gets detected and executed, but as soon as the next agent is in place the session gets closed- or something such that the channel just gets filled with noise. It seems that it somehow closes down the twilio session, but it does hang up...

Debug information

  • Agents SDK version: newest version
  • Python version: Python 3.10

Repro steps

Extend https://github.com/openai/openai-agents-python/blob/main/examples/realtime/twilio/twilio_handler.py

With two agents like so:

agent = RealtimeAgent(
    name="Twilio Assistant",
    instructions="You are a helpful assistant that starts every conversation with a creative greeting. Keep responses concise and friendly since this is a phone conversation.",
    tools=[get_weather, get_current_time],
)

permission_agent = RealtimeAgent(
    name="Twilio Permission",
    instructions="You are a helpful assistant that greets everyone and asks them if they are okay with being recorded. If yes, handover to the agent ",
    handoff=[agent],
)

....
async def start(self) -> None:
        """Start the session."""
        runner = RealtimeRunner(permission_agent )
        api_key = os.getenv("OPENAI_API_KEY")

Just run the demo and say yes to the first permission agent, and the phone line just becomes filled with static noise.

Expected behavior

I expected to get transferred to the next agent

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions