LangGraph agent keeps transferring back immediately

I’m building a booking assistant using LangGraph with a supervisor and booking agent. My issue is that the booking agent immediately transfers control back to the supervisor instead of gathering necessary booking information from the user.

Current behavior:

  1. Supervisor transfers to booking agent
  2. Booking agent immediately transfers back without gathering context
  3. No opportunity to ask essential booking questions (dates, preferences, etc.)

Expected behavior:

  1. Booking agent should maintain control
  2. Ask series of questions to gather booking context
  3. Only transfer back after collecting all necessary information and completing the booking

Interesting note: This works correctly when using custom LangGraph implementation with explicit handoffs defined in a state graph, but fails with the prebuilt supervisor pattern.

Simplified code:

booking_agent = create_react_agent(
    model=llm,
    tools=[check_availability, make_booking, cancel_booking],
    prompt="You are a booking agent. Gather all necessary information before making a booking",
    name="booking_agent",
)

supervisor = create_supervisor(
    model=model,
    agents=[booking_agent],
    prompt="Transfer booking questions to booking agent, let it handle full conversation",
    add_handoff_back_messages=True,
).compile()

How can I prevent the immediate transfer back and allow the agent to gather all necessary context through conversation before using its tools?

1 Like

If you want to keep conversing with the booking agent, try using a swarm architecture instead: GitHub - langchain-ai/langgraph-swarm-py: For your multi-agent needs.

The idea is that the graph state keeps track of the active agent: langgraph-swarm-py/langgraph_swarm/swarm.py at main · langchain-ai/langgraph-swarm-py · GitHub

Then the active agent can transfer a user to another agent based on a tool call.

Will check it out .
Thanks a lot !

Where you able to fix it by using a swarm?

The first thing I would try is expanding the prompt of the booking agent a bit more.

For example:

You are a booking agent. Gather all necessary information before making a booking. You should always do the following steps.
1. Check if there is still availability
2. ...
3. ...
etc
<<fill in the steps>>

Use tools when needed.

Make sure to use a model that supports tool calling as well and preferably is recomended for agentic use.