Python: fix declarative workflow DevUI sample and JoinExecutor Messag…#7206
Open
amit12cool wants to merge 5 commits into
Open
Python: fix declarative workflow DevUI sample and JoinExecutor Messag…#7206amit12cool wants to merge 5 commits into
amit12cool wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the Python declarative-workflow DevUI sample so it correctly categorizes users based on age entered via the chat UI (using System.LastMessage.Text / Local.* / Workflow.Outputs.*), and updates the declarative workflow runtime so JoinExecutor properly initializes state when triggered with a single Message.
Changes:
- Updated the DevUI sample
workflow.yamlto read age from chat text, useLocal.*variables, and correctly write outputs toWorkflow.Outputs.*. - Improved DevUI sample startup logging readability by configuring
logging.basicConfig(...). - Updated
JoinExecutorto normalize a singleMessagetrigger tolist[Message]before state initialization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| python/samples/02-agents/devui/workflow_declarative/workflow.yaml | Fixes expression namespaces and input source so DevUI chat input drives correct branching and output state. |
| python/samples/02-agents/devui/workflow_declarative/workflow.py | Adds simple logging configuration to make DevUI startup output easier to read. |
| python/packages/declarative/agent_framework_declarative/_workflows/_executors_control_flow.py | Ensures JoinExecutor correctly initializes state for single-Message triggers (DevUI-style). |
Contributor
|
Per the PR guidelines, please link an issue to this PR.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation & Context
The
workflow_declarativeDevUI sample underpython/samples/02-agents/devui/workflow_declarative/was broken when run via the DevUI chat interface. Entering any age value always returned the "child" category. Four bugs caused this:workflow.yamlused=inputs.age— this only works when the workflow is invoked with a structured dict input (e.g.{"age": 25}). The DevUI sends user messages as chat text, which populatesSystem.LastMessage.Text, notInputs.age. As a result=inputs.agewas alwaysBlank(treated as0by PowerFx), causing0 < 13to always evaluateTrue→ "child" for any input.workflow.yamlusedturn.*namespace —turnis a .NET/Bot Framework convention. In the Python runtime, per-turn variables belong in theLocal.*namespace.workflow.yamlusedworkflow.outputs.category(lowercasew) — the Python state engine is case-sensitive; the correct namespace isWorkflow.Outputs.*.JoinExecutordid not handle a singleMessagetrigger — when aMessage(notlist[Message]) was passed as the trigger,_ensure_state_initializedcould not extract the user text intoSystem.LastMessage.Text, compounding issue 1.Description & Review Guide
What are the major changes?
workflow.yaml: replace=inputs.agewith=Int(System.LastMessage.Text); replaceturn.*withLocal.*; fixworkflow.outputs.category→Workflow.Outputs.category; remove the now-unusedinputs:schema blockworkflow.py: addlogging.basicConfigso DevUI startup output is readable_executors_control_flow.py(JoinExecutor): normalize a singleMessagetrigger tolist[Message]before passing to_ensure_state_initialized, so user text is correctly surfaced inSystem.LastMessage.TextWhat is the impact of these changes?
The DevUI sample now works correctly end-to-end.
JoinExecutoralso correctly handles single-message triggers in all workflows that use it.What do you want reviewers to focus on?
The
JoinExecutorchange in_executors_control_flow.pyand whether any other executors have the same single-Messagegap.Related Issue
Fixes #
Contribution Checklist