Skip to content

OTel attributes are incomplete when using Agent.run_stream_sync #3714

@DouweM

Description

@DouweM

Initial Checks

Description

As reported on Slack: https://pydanticlogfire.slack.com/archives/C083V7PMHHA/p1765485304294729

run_stream_sync:

Image

run_stream:

Image

Example Code

import asyncio

import logfire
from pydantic_ai import Agent

logfire.configure()
logfire.instrument_pydantic_ai()

agent = Agent("openai:gpt-5.2")

response = agent.run_stream_sync("What is the capital of the UK?")
print(response.get_output())


async def main():
    async with agent.run_stream("What is the capital of the UK?") as response:
        print(await response.get_output())


asyncio.run(main())

Python, Pydantic AI & LLM client version

main

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions