类 Plan

java.lang.Object
io.agentscope.core.plan.model.Plan

public class Plan extends Object
Represents a plan containing a sequence of subtasks.

A plan breaks down a complex task into manageable subtasks with clear goals and expected outcomes. It tracks the overall progress and provides a structured approach to task execution.

Usage Example:


 Plan plan = new Plan(
     "Build E-commerce Website",
     "Build a complete e-commerce platform with authentication and payment",
     "Fully functional website deployed online",
     List.of(
         new SubTask("Setup", "Initialize project", "Project ready"),
         new SubTask("Auth", "Implement authentication", "Users can login"),
         new SubTask("Cart", "Implement shopping cart", "Cart works")
     )
 );
 
  • 构造器详细资料

    • Plan

      public Plan()
      Default constructor for deserialization.
    • Plan

      public Plan(String name, String description, String expectedOutcome, List<SubTask> subtasks)
      Create a new plan.
      参数:
      name - The plan name (should be concise, not exceed 10 words)
      description - The plan description including constraints and targets
      expectedOutcome - The expected outcome, specific and measurable
      subtasks - The list of subtasks that make up the plan
  • 方法详细资料

    • finish

      public void finish(PlanState state, String outcome)
      Mark the plan as finished.
      参数:
      state - The final state (DONE or ABANDONED)
      outcome - The actual outcome or reason for abandoning
    • toMarkdown

      public String toMarkdown(boolean detailed)
      Convert to markdown representation.
      参数:
      detailed - Whether to include detailed information for subtasks
      返回:
      Markdown string representation
    • getId

      public String getId()
      Gets the unique identifier of this plan.
      返回:
      The plan ID (UUID format)
    • setId

      public void setId(String id)
      Sets the unique identifier of this plan.
      参数:
      id - The plan ID
    • getName

      public String getName()
      Gets the name of this plan.
      返回:
      The plan name
    • setName

      public void setName(String name)
      Sets the name of this plan.
      参数:
      name - The plan name
    • getDescription

      public String getDescription()
      Gets the description of this plan.
      返回:
      The plan description including constraints and targets
    • setDescription

      public void setDescription(String description)
      Sets the description of this plan.
      参数:
      description - The plan description
    • getExpectedOutcome

      public String getExpectedOutcome()
      Gets the expected outcome of this plan.
      返回:
      The expected outcome (specific and measurable)
    • setExpectedOutcome

      public void setExpectedOutcome(String expectedOutcome)
      Sets the expected outcome of this plan.
      参数:
      expectedOutcome - The expected outcome
    • getSubtasks

      public List<SubTask> getSubtasks()
      Gets the list of subtasks in this plan.
      返回:
      The subtasks list
    • setSubtasks

      public void setSubtasks(List<SubTask> subtasks)
      Sets the list of subtasks for this plan.
      参数:
      subtasks - The subtasks list
    • getCreatedAt

      public String getCreatedAt()
      Gets the creation timestamp of this plan.
      返回:
      The creation time (formatted as "yyyy-MM-dd HH:mm:ss")
    • setCreatedAt

      public void setCreatedAt(String createdAt)
      Sets the creation timestamp of this plan.
      参数:
      createdAt - The creation time
    • getState

      public PlanState getState()
      Gets the current state of this plan.
      返回:
      The plan state (TODO, IN_PROGRESS, DONE, or ABANDONED)
    • setState

      public void setState(PlanState state)
      Sets the state of this plan.
      参数:
      state - The plan state
    • getFinishedAt

      public String getFinishedAt()
      Gets the timestamp when this plan was finished.
      返回:
      The finish time, or null if not finished yet
    • setFinishedAt

      public void setFinishedAt(String finishedAt)
      Sets the timestamp when this plan was finished.
      参数:
      finishedAt - The finish time
    • getOutcome

      public String getOutcome()
      Gets the actual outcome of this plan.
      返回:
      The actual outcome (if done) or reason for abandoning
    • setOutcome

      public void setOutcome(String outcome)
      Sets the actual outcome of this plan.
      参数:
      outcome - The actual outcome or reason