From defb397e7c6c3a8804b8ea657228b2c2b86558d3 Mon Sep 17 00:00:00 2001 From: Adi Berkowitz Date: Sun, 9 Nov 2025 13:46:32 -0300 Subject: [PATCH 1/3] Fix yield run output result --- .../src/openinference/instrumentation/agno/_runs_wrapper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py b/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py index 5b3996e8a6..ea4a41d008 100644 --- a/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py +++ b/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py @@ -503,9 +503,8 @@ async def arun_stream( try: current_run_id = None yield_run_output_set = False - if "yield_run_output" not in kwargs: + if kwargs.get("yield_run_output") or kwargs.get("yield_run_response"): yield_run_output_set = True - kwargs["yield_run_output"] = True # type: ignore run_response = None with trace_api.use_span(span, end_on_exit=False): team_token, team_ctx = _setup_team_context(instance, node_id) @@ -517,7 +516,7 @@ async def arun_stream( if isinstance(response, (RunOutput, TeamRunOutput)): run_response = response - if yield_run_output_set: + if not yield_run_output_set: continue yield response From 61afb36e819ef2f35adb0b70f42f97d799b302b4 Mon Sep 17 00:00:00 2001 From: Adi Berkowitz Date: Sun, 9 Nov 2025 13:48:53 -0300 Subject: [PATCH 2/3] Fied yield run --- .../src/openinference/instrumentation/agno/_runs_wrapper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py b/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py index ea4a41d008..77b1efc69d 100644 --- a/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py +++ b/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py @@ -346,9 +346,8 @@ def run_stream( try: current_run_id = None yield_run_output_set = False - if "yield_run_output" not in kwargs: + if kwargs.get("yield_run_output") or kwargs.get("yield_run_response"): yield_run_output_set = True - kwargs["yield_run_output"] = True # type: ignore run_response = None with trace_api.use_span(span, end_on_exit=False): @@ -361,7 +360,7 @@ def run_stream( if isinstance(response, (RunOutput, TeamRunOutput)): run_response = response - if yield_run_output_set: + if not yield_run_output_set: continue yield response From 27bbc2bc454012d59011d0cfb1a27c29f8dd1e8e Mon Sep 17 00:00:00 2001 From: Adi Berkowitz Date: Sun, 9 Nov 2025 14:15:17 -0300 Subject: [PATCH 3/3] Fix check for yield run output --- .../instrumentation/agno/_runs_wrapper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py b/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py index 77b1efc69d..d778b3aa16 100644 --- a/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py +++ b/python/instrumentation/openinference-instrumentation-agno/src/openinference/instrumentation/agno/_runs_wrapper.py @@ -346,7 +346,8 @@ def run_stream( try: current_run_id = None yield_run_output_set = False - if kwargs.get("yield_run_output") or kwargs.get("yield_run_response"): + if "yield_run_output" not in kwargs and "yield_run_response" not in kwargs: + kwargs["yield_run_output"] = True # type: ignore yield_run_output_set = True run_response = None @@ -360,7 +361,7 @@ def run_stream( if isinstance(response, (RunOutput, TeamRunOutput)): run_response = response - if not yield_run_output_set: + if yield_run_output_set: continue yield response @@ -502,8 +503,9 @@ async def arun_stream( try: current_run_id = None yield_run_output_set = False - if kwargs.get("yield_run_output") or kwargs.get("yield_run_response"): + if "yield_run_output" not in kwargs and "yield_run_response" not in kwargs: yield_run_output_set = True + kwargs["yield_run_output"] = True # type: ignore run_response = None with trace_api.use_span(span, end_on_exit=False): team_token, team_ctx = _setup_team_context(instance, node_id) @@ -515,7 +517,7 @@ async def arun_stream( if isinstance(response, (RunOutput, TeamRunOutput)): run_response = response - if not yield_run_output_set: + if yield_run_output_set: continue yield response