Skip to content

Commit 1c009f3

Browse files
authored
Don't set non-recording span as current (#1527)
1 parent 27eac30 commit 1c009f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pydantic_ai_slim/pydantic_ai/agent.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ async def get_instructions(run_context: RunContext[AgentDepsT]) -> str | None:
659659
start_node,
660660
state=state,
661661
deps=graph_deps,
662-
span=use_span(run_span, end_on_exit=True),
662+
span=use_span(run_span, end_on_exit=True) if run_span.is_recording() else None,
663663
infer_name=False,
664664
) as graph_run:
665665
yield AgentRun(graph_run)

0 commit comments

Comments
 (0)