Skip to content

Conversation

raghav-2002-os
Copy link

@raghav-2002-os raghav-2002-os commented Jul 16, 2025

The pull request contains code for the implementation of enhanced planning, i.e. generating sub steps for each step in Magentic UI plans. As steps generated in MagUI plan can be at times complex to be performed by the agent to which it is assigned, we can break down each of the steps into smaller sub steps. This provides a more granular plan for the agents to complete the task at hand and improves the overall pipeline
Below is the format of the generated plan dictionary with sub steps for each step:

{{
"terms": ["term1", "term2", ...],
"task": "summary of the goal and objective",
"needs_plan": true,
"response": "Short natural language summary of the plan",
"plan_summary": "Concise overview of the plan",
"steps": {{
"Step 1": {{
"title": "Title of the step",
"details": "Purpose and scope of this step",
"agent_name": "Agent responsible for this step",
"substeps": {{
"1.1": {{
"title": "Title of the sub-step",
"details": "What this sub-step does",
"status": "Current state in plan, recap prev steps and highlights next steps"
}},
"1.2": {{
...
}}
}}
}},
"Step 2": {{
...
}}
}}
}}

@raghav-2002-os raghav-2002-os changed the title MSRI Enhanced Planning MSRI Improved planning via introduction of sub steps in MagUI plans Jul 16, 2025
@raghav-2002-os raghav-2002-os changed the title MSRI Improved planning via introduction of sub steps in MagUI plans Improved planning via introduction of sub steps in MagUI plans Jul 16, 2025
Copy link
Contributor

@Copilot 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 introduces enhanced planning functionality to the MagUI orchestrator by adding support for hierarchical sub-steps within plan steps. The enhancement allows complex steps to be broken down into smaller, more granular sub-steps that can be executed by agents more effectively.

Key changes:

  • Added new enhanced planning prompt that generates hierarchical plans with sub-steps
  • Implemented validation and formatting logic for the new enhanced plan structure
  • Modified orchestrator to conditionally use enhanced planning when enabled

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
src/magentic_ui/teams/orchestrator/_prompts.py Adds enhanced planning prompt template and validation function for hierarchical plans
src/magentic_ui/teams/orchestrator/_orchestrator.py Integrates enhanced planning into orchestrator workflow with format conversion logic
Comments suppressed due to low confidence (1)

src/magentic_ui/teams/orchestrator/_orchestrator.py:416

  • [nitpick] The function name 'change_format' is vague. Consider a more descriptive name like 'convert_enhanced_plan_to_standard_format' or 'flatten_enhanced_plan'
    async def change_format(self,response):

content=self._get_task_ledger_plan_prompt(
self._team_description
),
content=self._get_task_ledger_plan_prompt_enhanced(self._team_description,user_query),
Copy link
Preview

Copilot AI Jul 16, 2025

Choose a reason for hiding this comment

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

Missing space after comma in function call. Should be: self._get_task_ledger_plan_prompt_enhanced(self._team_description, user_query)

Suggested change
content=self._get_task_ledger_plan_prompt_enhanced(self._team_description,user_query),
content=self._get_task_ledger_plan_prompt_enhanced(self._team_description, user_query),

Copilot uses AI. Check for mistakes.

@husseinmozannar
Copy link
Contributor

Hello do you mind running "poe check" on your code to make sure it does formatting and pyright checks? Thank you!

@raghav-2002-os
Copy link
Author

Hi Hussein,
Thanks for pointing that out!
I have performed the "poe check" and updated the code

@husseinmozannar
Copy link
Contributor

@raghav-2002-os please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@raghav-2002-os Do you mind replying to this please?

A few questions:

  1. What is the purpose of the terms field? Do you think it is necessary for the plans? My bias is to reduce the amount of fields the LLMs should generate

  2. I noticed a flag "enhanced_plan" in the orchestrator, do you imagine using this to toggle on/off the new plan format? If so it needs to be added to the orchestrator config object and then have the orchestrator use it to select the appropriate plan

@raghav-2002-os raghav-2002-os force-pushed the msri_enhanced_planning branch 6 times, most recently from 55ba63b to 977cba1 Compare July 21, 2025 09:47
@raghav-2002-os raghav-2002-os force-pushed the msri_enhanced_planning branch 2 times, most recently from 3c1c0bc to d8b80a4 Compare July 21, 2025 10:03
@raghav-2002-os
Copy link
Author

@microsoft-github-policy-service agree company="Microsoft"

@raghav-2002-os
Copy link
Author

raghav-2002-os commented Jul 21, 2025

Regarding the questions:

  1. Yes, I feel the "terms" field is important as it highlights the key components of the query. It would be helpful in resolving ambiguous queries
  2. You are right about the use of "enhanced_plan" flag. I have now added it to orchestrator config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants