Enum Class AgentState

java.lang.Object
java.lang.Enum<AgentState>
com.tnsai.hooks.events.AgentState
All Implemented Interfaces:
Serializable, Comparable<AgentState>, Constable

public enum AgentState extends Enum<AgentState>
Lifecycle state of an Agent. Read via Agent.getState(); transitions surface as OnStateTransition hook events for observers.

Standard transition graph:

   CREATED ──▶ STARTING ──▶ RUNNING ──▶ STOPPING ──▶ STOPPED
      │           │            │
      └───────────┴────────────┴──────▶ FAILED  (terminal)
 

FAILED is terminal — agents cannot recover in-place; an operator must construct a new instance. STOPPED is also terminal but represents a clean shutdown rather than an error.

Since:
0.5.0 (issue #21; foundation seeded by #60)
  • Enum Constant Details

    • CREATED

      public static final AgentState CREATED
      Constructed but no lazy initialisation has run yet.
    • STARTING

      public static final AgentState STARTING
      Lazy initialisation in progress. chat() blocks or rejects.
    • RUNNING

      public static final AgentState RUNNING
      Ready to process messages. The only state in which chat() succeeds.
    • STOPPING

      public static final AgentState STOPPING
      stop() has been called; in-flight work is being drained.
    • STOPPED

      public static final AgentState STOPPED
      Fully stopped, resources released. Terminal — no transitions out.
    • FAILED

      public static final AgentState FAILED
      Unrecoverable error during initialisation or execution. Terminal — no transitions out; construct a new agent instance to retry.
  • Method Details

    • values

      public static AgentState[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AgentState valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null