Skip to content

Fix agent lifecycle example output to reflect correct hook execution order #1015

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

Merged
merged 2 commits into from
Jul 8, 2025

Conversation

DanielHashmi
Copy link
Contributor

Problem:
The expected output in the agent lifecycle example incorrectly shows agent start hooks (on_start) running after tool execution and multiple times for the same agent. This misleads developers about when these lifecycle events actually occur.

Solution:
Updated the expected output to accurately reflect the OpenAI Agents framework behavior:

  • Agent start hooks run immediately when an agent begins execution
  • Start hooks only run once per agent activation, controlled by the should_run_agent_start_hooks flag
  • After handoffs, the new agent's start hook runs as the first event

@seratch seratch added the documentation Improvements or additions to documentation label Jul 8, 2025
@rm-openai rm-openai merged commit f09874c into openai:main Jul 8, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants