Skip to content

Conversation

@CLowbrow
Copy link
Contributor

No description provided.

yield bgl


def test_tracing_processor_sets_current_span(memory_logger):
Copy link
Collaborator

Choose a reason for hiding this comment

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

would be great to see a real example repro the problem and that with this fix fixes the problem.

Copy link
Contributor

Choose a reason for hiding this comment

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

To repro, I used the following:

from agents import set_trace_processors, trace

from braintrust import flush, init_logger, start_span
from braintrust.wrappers.openai import BraintrustTracingProcessor


def run_demo():
    bt_logger = init_logger(project="8375-agents-sdk")

    set_trace_processors([BraintrustTracingProcessor(bt_logger)])

    with trace(workflow_name="workflow"):
        with start_span(name="child-span"):
            pass

    flush()


if __name__ == "__main__":
    run_demo()

Before the fix, I got the workflow root span and child-span in separate traces.

Screenshot 2025-11-14 at 5 12 47 PM

After this fix and after running

pip install --force-reinstall \ "braintrust[openai-agents] @ git+https://github.com/braintrustdata/braintrust-sdk.git@alex/set-correct-parents#subdirectory=py"

Screenshot 2025-11-14 at 5 13 01 PM

I got the child-span span within the workflow trace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants