Skip to content

Conversation

@tonybaloney
Copy link

Fixes #1310

@github-actions github-actions bot changed the title Handle dict input for MagenticStartMessage Python: Handle dict input for MagenticStartMessage Oct 13, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Oct 13, 2025

@tonybaloney tonybaloney marked this pull request as ready for review October 14, 2025 00:14
@Copilot Copilot AI review requested due to automatic review settings October 14, 2025 00:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for handling dictionary input when starting a Magentic workflow, specifically for dictionaries containing an "input" key. The change allows the workflow to accept dictionary messages and extract the text content from the "input" field.

  • Added dictionary input handling for MagenticStartMessage creation
  • Extracts text from dict["input"] and converts it to a MagenticStartMessage using the existing from_string method

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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.
@moonbox3
Copy link
Contributor

Hi @tonybaloney, thanks for working on this. I've done some refactoring to improve the orchestration start message types for Magentic, Concurrent, and Sequential patterns to be more reflective of agent patterns (and the input types they accept). This now allows for DevUI to properly introspect the Magentic input message type.

You can find this in an open PR I have: #1538

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

devui support for Magentic workflow

3 participants