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
@@ -315,14 +315,14 @@ class WorkflowAgent(BaseAgent):
|
||||
return update
|
||||
return None
|
||||
|
||||
case WorkflowOutputEvent(data=data, source_executor_id=source_executor_id):
|
||||
case WorkflowOutputEvent(data=data, executor_id=executor_id):
|
||||
# Convert workflow output to an agent response update.
|
||||
# Handle different data types appropriately.
|
||||
|
||||
# Skip AgentResponse from AgentExecutor with output_response=True
|
||||
# since streaming events already surfaced the content.
|
||||
if isinstance(data, AgentResponse):
|
||||
executor = self.workflow.executors.get(source_executor_id)
|
||||
executor = self.workflow.executors.get(executor_id)
|
||||
if isinstance(executor, AgentExecutor) and executor.output_response:
|
||||
return None
|
||||
|
||||
@@ -332,7 +332,7 @@ class WorkflowAgent(BaseAgent):
|
||||
return AgentResponseUpdate(
|
||||
contents=list(data.contents),
|
||||
role=data.role,
|
||||
author_name=data.author_name or source_executor_id,
|
||||
author_name=data.author_name or executor_id,
|
||||
response_id=response_id,
|
||||
message_id=str(uuid.uuid4()),
|
||||
created_at=datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
|
||||
@@ -344,7 +344,7 @@ class WorkflowAgent(BaseAgent):
|
||||
return AgentResponseUpdate(
|
||||
contents=contents,
|
||||
role=Role.ASSISTANT,
|
||||
author_name=source_executor_id,
|
||||
author_name=executor_id,
|
||||
response_id=response_id,
|
||||
message_id=str(uuid.uuid4()),
|
||||
created_at=datetime.now(tz=timezone.utc).strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
|
||||
|
||||
@@ -278,20 +278,20 @@ class WorkflowOutputEvent(WorkflowEvent):
|
||||
def __init__(
|
||||
self,
|
||||
data: Any,
|
||||
source_executor_id: str,
|
||||
executor_id: str,
|
||||
):
|
||||
"""Initialize the workflow output event.
|
||||
|
||||
Args:
|
||||
data: The output yielded by the executor.
|
||||
source_executor_id: ID of the executor that yielded the output.
|
||||
executor_id: ID of the executor that yielded the output.
|
||||
"""
|
||||
super().__init__(data)
|
||||
self.source_executor_id = source_executor_id
|
||||
self.executor_id = executor_id
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""Return a string representation of the workflow output event."""
|
||||
return f"{self.__class__.__name__}(data={self.data}, source_executor_id={self.source_executor_id})"
|
||||
return f"{self.__class__.__name__}(data={self.data}, executor_id={self.executor_id})"
|
||||
|
||||
|
||||
class SuperStepEvent(WorkflowEvent):
|
||||
|
||||
@@ -358,7 +358,7 @@ class WorkflowContext(Generic[T_Out, T_W_Out]):
|
||||
self._yielded_outputs.append(copy.deepcopy(output))
|
||||
|
||||
with _framework_event_origin():
|
||||
event = WorkflowOutputEvent(data=output, source_executor_id=self._executor_id)
|
||||
event = WorkflowOutputEvent(data=output, executor_id=self._executor_id)
|
||||
await self._runner_context.add_event(event)
|
||||
|
||||
async def add_event(self, event: WorkflowEvent) -> None:
|
||||
|
||||
Reference in New Issue
Block a user