You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feat: separate tool_call_item and tool_call_output_item in stream events (#974)
### Summary
During my analysis of the streaming API (run_streamed) results, I
noticed that tool_call_item and tool_call_output_item events are
currently being emitted concurrently upon tool call completion (as
evidenced in [
#831](#831)). This
implementation conflates what should logically be distinct events. The
current PR addresses this by properly separating these event triggers to
better reflect the actual workflow.
### Test plan
The test file is created in `tests` named `test_stream_events.py`.Run
the test script below to test.
```bash
pytest -s test_stream_events.py
```
The test result is:
```text
======================================================================== test session starts ========================================================================
platform win32 -- Python 3.12.10, pytest-8.3.5, pluggy-1.5.0
rootdir: D:\moon\projects\openai-agents-python
configfile: pyproject.toml
plugins: anyio-4.9.0, inline-snapshot-0.22.3, asyncio-0.26.0, mock-3.14.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=session, asyncio_default_test_loop_scope=function
collected 1 item
tests\test_stream_events.py === Run starting ===
Agent updated: Joker
-- Message output:
a_message
-- Tool was called at 1751271106971851300
-- Tool output: success! at 1751271109987313900
-- Message output:
done
=== Run complete ===
.
========================================================================= 1 passed in 3.07s =========================================================================
```
### Issue number
[ #831](#831)
### Checks
- [x] I've added new tests (if relevant)
- [x] I've run `make lint` and `make format`
- [x] I've made sure tests pass
0 commit comments