类 SubTask

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

public class SubTask extends Object
Represents a subtask within a plan.

A subtask is a unit of work with a specific goal and expected outcome. It has a state that tracks its progress through the execution lifecycle.

Usage Example:


 SubTask task = new SubTask(
         "Setup project",
         "Initialize project structure with proper directory layout",
         "Project scaffolding completed");

 task.setState(SubTaskState.IN_PROGRESS);
 // ... execute task
 task.finish("Project initialized with src/, test/, and docs/ directories");
 
  • 构造器详细资料

    • SubTask

      public SubTask()
      Default constructor for deserialization.
    • SubTask

      public SubTask(String name, String description, String expectedOutcome)
      Create a new subtask.
      参数:
      name - The subtask name (should be concise, not exceed 10 words)
      description - The detailed description including constraints and targets
      expectedOutcome - The expected outcome, specific and measurable
  • 方法详细资料

    • finish

      public void finish(String outcome)
      Mark the subtask as finished with the actual outcome.
      参数:
      outcome - The actual outcome achieved
    • finish

      public void finish(SubTaskState state, String outcome)
      Mark the subtask as finished with a specific state and outcome.
      参数:
      state - The final state (e.g., DONE or ABANDONED)
      outcome - The actual outcome or reason for abandoning
      抛出:
      IllegalArgumentException - if the state is not a terminal state (DONE or ABANDONED)
    • toOneLineMarkdown

      public String toOneLineMarkdown()
      Convert to one-line markdown representation.
      返回:
      One-line markdown string
    • toMarkdown

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

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

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

      public String getDescription()
      Gets the description of this subtask.
      返回:
      The detailed description
    • setDescription

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

      public String getExpectedOutcome()
      Gets the expected outcome for this subtask.
      返回:
      The expected outcome
    • setExpectedOutcome

      public void setExpectedOutcome(String expectedOutcome)
      Sets the expected outcome for this subtask.
      参数:
      expectedOutcome - The expected outcome
    • getOutcome

      public String getOutcome()
      Gets the actual outcome achieved by this subtask.
      返回:
      The actual outcome, or null if not finished
    • setOutcome

      public void setOutcome(String outcome)
      Sets the actual outcome of this subtask.
      参数:
      outcome - The actual outcome
    • getState

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

      public void setState(SubTaskState state)
      Sets the state of this subtask.
      参数:
      state - The subtask state
    • getCreatedAt

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

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

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

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