feat: Implement Plan-and-Reflect Autonomous Loop #91
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.
This commit introduces a significant architectural enhancement to the Bytebot agent, moving it from a purely reactive model to a proactive, plan-driven autonomous system.
The core changes include:
PlannerService: A new service that uses an LLM to break down high-level user requests into a concrete, step-by-step plan.
ReflectorService: A new service that evaluates the outcome of each executed step. It determines if a step was successful, failed, or needs to be retried, enabling self-correction.
Plan-and-Execute Loop: The
AgentProcessor
has been refactored to orchestrate the new autonomous loop. It now generates a plan, executes it step-by-step, and reflects on each outcome to decide the next action.Database Schema: The
Task
model in the Prisma schema has been updated to store theplan
and the currentplanStep
, making the agent's state more robust and resumable.Testing:
PlannerService
has been added, which uncovered and led to a fix for a bug in handling empty LLM responses.This new architecture provides a strong foundation for future autonomous capabilities, such as more advanced planning, memory, and self-optimization.