Skip to content

How to use on_handoff content in the agent #627

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

Open
muneebarshadd opened this issue Apr 29, 2025 · 3 comments
Open

How to use on_handoff content in the agent #627

muneebarshadd opened this issue Apr 29, 2025 · 3 comments
Labels
question Question about using the SDK stale

Comments

@muneebarshadd
Copy link

muneebarshadd commented Apr 29, 2025

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

My setup:

  • Agent A is handling a task.
  • Agent A calls on_handoff to hand off the task to Agent B.
  • Inside the on_handoff function, I run another Agent C and gets it output. I want to add the output to the message history
  • You want Agent B to have access to the output from Agent C.

Is there a way to do this?

@muneebarshadd muneebarshadd added the question Question about using the SDK label Apr 29, 2025
@pakrym-oai
Copy link
Contributor

Have you considered using handoff input filters to modify the conversation history?

@muneebarshadd
Copy link
Author

Have you considered using handoff input filters to modify the conversation history?

I tried to use input filters but I am trying to access context from inputfilter function. But looks like RunContextWrapper can not be access from this function. Is there a work around? This is my code:


    def handoff_message_filter(
        handoff_message_data: HandoffInputData,
        run_context: RunContextWrapper[MyContext],
    ) -> HandoffInputData:
        history = run_context.context.query_converted

        return HandoffInputData(
            input_history=history,
            pre_handoff_items=tuple(handoff_message_data.pre_handoff_items),
            new_items=tuple(handoff_message_data.new_items),
        )

Copy link

github-actions bot commented May 7, 2025

This issue is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label May 7, 2025
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 stale
Projects
None yet
Development

No branches or pull requests

2 participants