Description
When using OpenAIChatClient from agent_framework.openai with stream=True, the final streamed response loses created_at.
More specifically:
await agent.run(..., stream=False) returns an AgentResponse with created_at populated
await agent.run(..., stream=True) followed by await stream.get_final_response() returns an AgentResponse with created_at=None
This becomes especially visible when using agent-framework-durabletask, because its durable entity path prefers stream=True first and then persists the final response. During persistence it logs:
Invalid or missing created_at value in durable agent state; defaulting to current UTC time, None
The durable flow still works because it falls back to the current UTC time, but the final streamed response metadata is wrong and the warning is noisy.
Minimal repro
import asyncio
import os
from azure.identity.aio import DefaultAzureCredential, get_bearer_token_provider
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
async def main():
async_credential = DefaultAzureCredential()
token_provider = get_bearer_token_provider(
async_credential,
"https://cognitiveservices.azure.com/.default",
)
client = OpenAIChatClient(
base_url=f"{os.environ['AZURE_OPENAI_ENDPOINT']}/openai/v1/",
api_key=token_provider,
model=os.environ["AZURE_OPENAI_CHAT_DEPLOYMENT"],
)
agent = Agent(
name="Probe",
instructions="Reply with ok only.",
client=client,
)
non_stream = await agent.run("say ok")
stream = await agent.run("say ok", stream=True)
async for _ in stream:
pass
final = await stream.get_final_response()
print("non_stream.created_at =", repr(non_stream.created_at))
print("stream_final.created_at =", repr(final.created_at))
await async_credential.close()
asyncio.run(main())
Observed output:
non_stream.created_at = '2026-04-18T12:48:06.000000Z'
stream_final.created_at = None
Additional validation
I also checked the raw final OpenAI streaming event. The final response.completed event still contains a populated timestamp on the embedded response object:
event.type == "response.completed"
event.response.created_at is populated
So the timestamp still exists in the raw streamed response, but it is not propagated into the final ChatResponse / AgentResponse.
Impact
- noisy warning in durabletask samples/apps
- incorrect metadata on final streamed responses
- fallback timestamp masks the issue, so behavior still appears to work while metadata is wrong
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core==1.0.0, agent-framework-openai==1.0.0, agent-framework-durabletask==1.0.0b260402
Python Version
3.12
Additional Context
No response
Description
When using
OpenAIChatClientfromagent_framework.openaiwithstream=True, the final streamed response losescreated_at.More specifically:
await agent.run(..., stream=False)returns anAgentResponsewithcreated_atpopulatedawait agent.run(..., stream=True)followed byawait stream.get_final_response()returns anAgentResponsewithcreated_at=NoneThis becomes especially visible when using
agent-framework-durabletask, because its durable entity path prefersstream=Truefirst and then persists the final response. During persistence it logs:The durable flow still works because it falls back to the current UTC time, but the final streamed response metadata is wrong and the warning is noisy.
Minimal repro
Observed output:
Additional validation
I also checked the raw final OpenAI streaming event. The final
response.completedevent still contains a populated timestamp on the embedded response object:event.type == "response.completed"event.response.created_atis populatedSo the timestamp still exists in the raw streamed response, but it is not propagated into the final
ChatResponse/AgentResponse.Impact
Code Sample
Error Messages / Stack Traces
Package Versions
agent-framework-core==1.0.0, agent-framework-openai==1.0.0, agent-framework-durabletask==1.0.0b260402
Python Version
3.12
Additional Context
No response