feat: implement multi-step planning loop with parallel execution and …#1672
Open
peterish8 wants to merge 2 commits into
Open
feat: implement multi-step planning loop with parallel execution and …#1672peterish8 wants to merge 2 commits into
peterish8 wants to merge 2 commits into
Conversation
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.
📋 Summary
Implements the four-phase planning loop described in issue #405, giving autonomous agents a structured way to approach complex multi-step goals. The existing ReAct loop handles single-shot tasks but has no mechanism for breaking down a complex goal, tracking progress across steps, adjusting when something fails, or synthesising partial results into a final answer.
🔗 Related Issues
Closes #405
🧠 Context
Agents given multi-part research tasks or complex data transformation pipelines today have no structured approach beyond fitting everything into a single prompt. This change adds a proper planning abstraction at the kernel level and a concrete executor at the foundation level, following the existing microkernel architecture.
🛠️ Changes
mofa-kernel: NewPlannertrait withPlanningRequest,ExecutionPlan,PlannedStep,MemoryItemSnapshot, andCompletedSteptypes.ExecutionPlanprovidesvalidate()andtopological_groups()for dependency-aware parallel scheduling.mofa-foundation:PromptPlanner(LLM-backedPlannerimpl) andPlanningExecutorrunning four phases — planning, parallel execution, per-step reflection, and synthesis. Independent steps run concurrently viafutures::join_all. Long-term memory is recalled during planning via the existingMemorytrait.examples/planning_agent: End-to-end example — three parallel research subtasks feed a synthesis step that produces a structured report.🧪 How you Tested
cargo check -p mofa-kernel -p mofa-foundation— passes cleancargo test -p mofa-kernel planner— 6 tests pass (topological sort, cycle detection, validation edge cases)cargo check -p planning_agent(fromexamples/) — compiles clean🧹 Checklist
Code Quality
cargo fmtruncargo clippypasses without warningsTesting
cargo testpasses locally without any errorDocumentation
PR Hygiene
main