Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions python/packages/core/agent_framework/_workflows/_magentic.py
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,8 @@ async def run_stream(self, message: Any | None = None) -> AsyncIterable[Workflow
message = MagenticStartMessage.from_string(message)
elif isinstance(message, ChatMessage):
message = MagenticStartMessage(task=message)
elif isinstance(message, dict) and "input" in message:
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dict input handling lacks validation. Consider validating that message['input'] is a string before passing it to from_string(), as the method expects a string parameter but could receive any type from the dict.

Suggested change
elif isinstance(message, dict) and "input" in message:
elif isinstance(message, dict) and "input" in message:
if not isinstance(message["input"], str):
raise TypeError(f"Expected 'input' to be a string, got {type(message['input']).__name__}")

Copilot uses AI. Check for mistakes.

message = MagenticStartMessage.from_string(message["input"])

async for event in self._workflow.run_stream(message):
yield event
Expand Down