Skip to content

fix: allow structured results in tool-end hooks#3513

Closed
he-yufeng wants to merge 1 commit into
openai:mainfrom
he-yufeng:fix/tool-end-hook-result
Closed

fix: allow structured results in tool-end hooks#3513
he-yufeng wants to merge 1 commit into
openai:mainfrom
he-yufeng:fix/tool-end-hook-result

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • change RunHooksBase.on_tool_end and AgentHooksBase.on_tool_end to accept structured tool results
  • add regression coverage for dict-valued function tool results reaching both run-level and agent-level hooks

Fixes #3512

To verify

  • uv run pytest tests/test_run_hooks.py -q
  • uv run pytest tests/test_agent_hooks.py tests/test_agent_llm_hooks.py tests/test_global_hooks.py tests/test_computer_action.py tests/test_run_step_execution.py -q
  • uv run ruff check src/agents/lifecycle.py tests/test_run_hooks.py tests/test_agent_hooks.py tests/test_agent_llm_hooks.py tests/test_global_hooks.py tests/test_computer_action.py tests/test_run_step_execution.py
  • uv run ruff format --check src/agents/lifecycle.py tests/test_run_hooks.py tests/test_agent_hooks.py tests/test_agent_llm_hooks.py tests/test_global_hooks.py tests/test_computer_action.py tests/test_run_step_execution.py
  • uv run mypy src/agents/lifecycle.py tests/test_run_hooks.py tests/test_agent_hooks.py tests/test_agent_llm_hooks.py tests/test_global_hooks.py tests/test_computer_action.py tests/test_run_step_execution.py
  • uv run pyright --project pyrightconfig.json src/agents/lifecycle.py tests/test_run_hooks.py tests/test_agent_hooks.py tests/test_agent_llm_hooks.py tests/test_global_hooks.py tests/test_computer_action.py tests/test_run_step_execution.py

@seratch
Copy link
Copy Markdown
Member

seratch commented May 28, 2026

Thanks for sharing this. Resolved by #3518

@seratch seratch closed this May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RunHooksBase on_tool_end result type error

2 participants