Skip to content

agent output format and handoff stability #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pandababyer opened this issue Apr 22, 2025 · 6 comments
Closed

agent output format and handoff stability #568

pandababyer opened this issue Apr 22, 2025 · 6 comments
Labels
question Question about using the SDK

Comments

@pandababyer
Copy link

Please read this first

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

Question

Hi, thanks for the great job!

In my situation, user chat with assistant agent and when assistant agent collect enough information, it will send a message like "hold on, i will back soon", at the same time, hand off to a search agent, the search agent finish rest task. here is my question:

  1. the assistant agent can't guarantee send a message and handoff to the search agent. it usually send a message " hold on ..." but not hand off to search agent or direct handoff to search agent without send a message

  2. sometime, the assistant agent will generate a message "hold on ..." and "transfer_to_search_agent..." to the user, which is not right. I hope "transfer_to_search_agent..." will never show to the user because it's work mechanism of my multi-agent system.

I have try to write the rule in my prompt and strict output_type of assistant agent, but still failed.

@pandababyer pandababyer added the question Question about using the SDK label Apr 22, 2025
@DanieleMorotti
Copy link
Contributor

Hi, what about printing a deterministic "hold on" message when handoff occurs?

In this case the model is in charge to handoff to the next agent but you will print a default message for the user on that action. I don't know if this is acceptable for you

@pandababyer
Copy link
Author

@DanieleMorotti thanks for your suggestion! it's a feasible solution, because my main goal is to ensure that the next agent is correctly handed off when the conditions are met.

However, I still want to know how to make the model generate "hold on" messages and have stable handoff :)

@rm-openai
Copy link
Collaborator

@pandababyer sounds like the thing you want is for the model to reliably generate both:

  1. Text to show to the user
  2. A function call to perform the handoff

Is that right?

@pandababyer
Copy link
Author

@rm-openai yes, that’s exactly what I need.

@rm-openai
Copy link
Collaborator

@pandababyer what model are you using? Most likely this will be something you can prompt the model for.

@pandababyer
Copy link
Author

@rm-openai GPT-4o

What stuck me is the model will misunderstanding the function call and send it to the user as part of the text. like below:

Let me find some options for you. Hang tight!

transfer_to_search_agent(input={xxxx})

I suspect there is something wrong with my prompt , here is my prompt part:

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about using the SDK
Projects
None yet
Development

No branches or pull requests

3 participants