Skip to content

Conversation

rm-openai
Copy link
Collaborator

@rm-openai rm-openai commented Apr 17, 2025

Closes #435 and closes #538.

Unit tests.

@JilinJL
Copy link

JilinJL commented Apr 18, 2025

@rm-openai Is there any problem here, please viewit very much, 🌹🌹
#516

disabled=run_config.tracing_disabled,
)
)
# Need to start the trace here, because the current trace contextvar is captured at
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong but won't this break the following use case:

    result = Runner.run_streamed(
        agent, "Write ten haikus about recursion in programming."
    )

    i = 0
    async for event in result.stream_events():
        with custom_span("Processing event " + str(i)):
            print(event)
            i += 1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, you're right. Talked on slack, the fix for this would be to manually attach to the trace via:

  async for event in result.stream_events():
        with custom_span("Processing event " + str(i), parent=result.trace):
            print(event)
            i += 1

@rm-openai rm-openai merged commit 616d8e7 into main Apr 21, 2025
10 checks passed
@rm-openai rm-openai deleted the rm/pr540 branch April 21, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants