mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
fix(workflows): rename WorkflowOutputEvent.source_executor_id to executor_id for API consistency (#3166)
This commit is contained in:
committed by
GitHub
Unverified
parent
ffe2e787ba
commit
80b25a782b
@@ -881,7 +881,7 @@ class MessageMapper:
|
||||
# Handle WorkflowOutputEvent separately to preserve output data
|
||||
if event_class == "WorkflowOutputEvent":
|
||||
output_data = getattr(event, "data", None)
|
||||
source_executor_id = getattr(event, "source_executor_id", "unknown")
|
||||
executor_id = getattr(event, "executor_id", "unknown")
|
||||
|
||||
if output_data is not None:
|
||||
# Import required types
|
||||
@@ -942,7 +942,7 @@ class MessageMapper:
|
||||
# Emit output_item.added for each yield_output
|
||||
logger.debug(
|
||||
f"WorkflowOutputEvent converted to output_item.added "
|
||||
f"(executor: {source_executor_id}, length: {len(text)})"
|
||||
f"(executor: {executor_id}, length: {len(text)})"
|
||||
)
|
||||
return [
|
||||
ResponseOutputItemAddedEvent(
|
||||
|
||||
@@ -269,8 +269,7 @@ export interface AgentThread {
|
||||
export interface WorkflowEvent {
|
||||
type?: string; // Event class name like "WorkflowOutputEvent", "WorkflowCompletedEvent", "ExecutorInvokedEvent", etc.
|
||||
data?: unknown;
|
||||
executor_id?: string; // Present for executor-related events
|
||||
source_executor_id?: string; // Present for WorkflowOutputEvent
|
||||
executor_id?: string; // Present for executor-related events and WorkflowOutputEvent
|
||||
}
|
||||
|
||||
export interface WorkflowStartedEvent extends WorkflowEvent {
|
||||
@@ -286,7 +285,7 @@ export interface WorkflowCompletedEvent extends WorkflowEvent {
|
||||
export interface WorkflowOutputEvent extends WorkflowEvent {
|
||||
// Event-specific data for workflow output (new)
|
||||
readonly event_type: "workflow_output";
|
||||
source_executor_id: string; // ID of executor that yielded the output
|
||||
executor_id: string; // ID of executor that yielded the output
|
||||
}
|
||||
|
||||
export interface WorkflowWarningEvent extends WorkflowEvent {
|
||||
|
||||
@@ -585,7 +585,7 @@ async def test_workflow_output_event(mapper: MessageMapper, test_request: AgentF
|
||||
"""Test WorkflowOutputEvent is converted to output_item.added."""
|
||||
from agent_framework._workflows._events import WorkflowOutputEvent
|
||||
|
||||
event = WorkflowOutputEvent(data="Final workflow output", source_executor_id="final_executor")
|
||||
event = WorkflowOutputEvent(data="Final workflow output", executor_id="final_executor")
|
||||
events = await mapper.convert_event(event, test_request)
|
||||
|
||||
# WorkflowOutputEvent should emit output_item.added
|
||||
@@ -607,7 +607,7 @@ async def test_workflow_output_event_with_list_data(mapper: MessageMapper, test_
|
||||
ChatMessage(role=Role.USER, contents=[TextContent(text="Hello")]),
|
||||
ChatMessage(role=Role.ASSISTANT, contents=[TextContent(text="World")]),
|
||||
]
|
||||
event = WorkflowOutputEvent(data=messages, source_executor_id="complete")
|
||||
event = WorkflowOutputEvent(data=messages, executor_id="complete")
|
||||
events = await mapper.convert_event(event, test_request)
|
||||
|
||||
assert len(events) == 1
|
||||
|
||||
Reference in New Issue
Block a user