Skip to content

Intermittent 60+ sec delays during agent hand-offs in multi-agent flows #1219

@ausafulislam

Description

@ausafulislam

Please read this first

  • Have you read the docs?Agents SDK docs
  • Have you searched for related issues? Others may have had similar requests

Question

Intermittent 60+ sec delays during agent hand-offs in multi-agent flows

Solution

We're using openai-agents-python version 0.0.14 with Python 3.13.2 and running a multi-agent flow with around 10 agents. In several test runs, we've encountered intermittent but significant delays (60+ seconds) during transitions, especially on very simple agents like a "hand-off" agent that does not invoke tools or perform any complex reasoning. The behavior seems random and isn't tied to the complexity of the prompt or length of conversation history.

To debug, we enabled full logging with OPENAI_LOG=debug and wrapped each agent's execution in a timer like this:


start = time.time()
response = await agent.run(input)
print("Agent response time:", time.time() - start)

This confirmed that the delays are happening before the LLM responds, specifically during orchestration between agents.

In our tests, we found that long histories being passed between agents could be a factor. Truncating history reduced the frequency of these delays. For example:

agent = agent.with_history(agent.history[-3:])

Limiting the history to just the last few steps noticeably improved performance and made the behavior more predictable.

We also tried isolating the issue by running the same flow with only 2–3 agents. In those cases, we did not encounter the delay. Reintroducing the full 10-agent structure brought the random long wait times back.

It seems the issue may be related to context size and the way agent orchestration manages history or async execution when the number of agents grows.

We're currently working around the issue by

Truncating history on each agent call

Setting max_tokens and response_format="json" in the completion config

Avoiding unnecessary agent-to-agent hops

If there's a better way to handle context or limit orchestration overhead, we'd love to follow recommended practices. We're also open to contributing a utility that trims history automatically or logs timing per step if that's helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions