Description
If a workflow has an agent executor which has response_format set, the response format value is set to None if the workflow outputs are streamed. If the workflow is not streamed, the value is set as expected.
Code Sample
from typing import Never
from agent_framework import (
AgentExecutorResponse,
Workflow,
WorkflowBuilder,
WorkflowContext,
executor,
)
from agent_framework.azure import AzureOpenAIResponsesClient
from azure.identity import DefaultAzureCredential
from pydantic import BaseModel
class Greeting(BaseModel):
greeting: str
@executor
async def print_executor(message: AgentExecutorResponse, ctx: WorkflowContext[Never, str]):
await ctx.yield_output(f"Value: {message.agent_response.value}, Text: {message.agent_response.text}")
def build_workflow() -> Workflow:
agent = AzureOpenAIResponsesClient(credential=DefaultAzureCredential()).as_agent(
default_options={
"temperature": 0,
"response_format": Greeting,
}
)
return (
WorkflowBuilder(
start_executor=agent,
output_executors=[print_executor],
)
.add_edge(agent, print_executor)
.build()
)
async def main() -> None:
print("--------- Non-Streaming ---------")
workflow = build_workflow()
result = await workflow.run("Hello")
for output in result.get_outputs():
print(output)
print("--------- Streaming ---------")
workflow = build_workflow()
async for output in workflow.run("Hello", stream=True):
if output.type == "output":
print(output.data)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Output
--------- Non-Streaming ---------
Value: greeting='Hello! How can I assist you today?', Text: {"greeting":"Hello! How can I assist you today?"}
--------- Streaming ---------
Value: None, Text: {"greeting":"Hello! How can I assist you today?"}
Package Versions
1.0.0b260212
Python Version
3.13
Additional Context
No response
Description
If a workflow has an agent executor which has
response_formatset, the response format value is set toNoneif the workflow outputs are streamed. If the workflow is not streamed, the value is set as expected.Code Sample
Output
Package Versions
1.0.0b260212
Python Version
3.13
Additional Context
No response