Repository navigation
Description
Description
When a workflow executor emits a message-bearing AgentResponse and the workflow is consumed through Workflow.as_agent().run(stream=True), WorkflowAgent converts the response messages into AgentResponseUpdate objects but silently drops response-level metadata that the update type can represent:
agent_idfinish_reasoncontinuation_tokenadditional_properties
Actual behavior: the message content is preserved, but all four fields are None on the generated update.
Expected behavior: converting a message-bearing AgentResponse to streaming updates should preserve representable response-level metadata without changing message count or ordering.
Code Sample
import asyncio
from typing import Never
from agent_framework import (
AgentResponse,
Message,
WorkflowBuilder,
WorkflowContext,
executor,
)
@executor
async def emit_response(
_messages: list[Message],
ctx: WorkflowContext[Never, AgentResponse],
) -> None: # type: ignore[valid-type]
await ctx.yield_output(
AgentResponse(
messages=[Message(role="assistant", contents=["payload"])],
agent_id="source-agent",
finish_reason="length",
continuation_token={"token": "resume-token"},
additional_properties={"provider_marker": "preserve-me"},
)
)
async def main() -> None:
workflow = WorkflowBuilder(start_executor=emit_response).build()
updates = [
update
async for update in workflow.as_agent("wrapped-workflow").run(
"hello",
stream=True,
)
]
update = updates[0]
print(
{
"agent_id": update.agent_id,
"finish_reason": update.finish_reason,
"continuation_token": update.continuation_token,
"additional_properties": update.additional_properties,
}
)
asyncio.run(main())Error Messages / Stack Traces
No exception is raised.
On current main, the output is:
{'agent_id': None, 'finish_reason': None, 'continuation_token': None, 'additional_properties': None}
Package Versions
agent-framework-core: local source from main at 0275ebfd026e3549b9377788aedb58f424997fb2
Python Version
Python 3.11.14
Additional Context
#7952 reported the equivalent metadata loss for the neighboring AgentResponseUpdate reconstruction branch. #7999 fixed that branch by preserving these fields and explicitly identified the AgentResponse branch as possible follow-up scope.
Existing workflow-agent tests cover streaming message content from an AgentResponse, but do not cover response metadata preservation on that conversion path.
Metadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
github-actions commentedon Sep 17, 2026
🤖 Automated triage reproduction notes (agent-authored — trust but verify)
Agent analysis
Repro:
python/packages/core/agent_framework/_workflows/_agent.py::_convert_workflow_event_to_agent_response_updatesdrops response metadata in theAgentResponsebranch at lines 672-688. It occurs when a forwarded workflow event contains a message-bearingAgentResponsewithagent_id,finish_reason,continuation_token, oradditional_properties. Minimal repro: yield such a response from an executor, consumeworkflow.as_agent().run(stream=True), and inspect the generated updates.python/packages/core/tests/workflow/test_workflow_agent.py::TestWorkflowAgent::test_workflow_as_agent_stream_preserves_agent_response_metadata1.18.0