Class ThreadSpec

java.lang.Object
com.tnsai.thread.ThreadSpec

public final class ThreadSpec extends Object
Configuration for an AgentThread.

Includes:

  • Resource quotas (tokens, tool calls, duration)
  • Recovery settings (auto-resume, max retries)
  • Spec (tags, labels)
  • Checkpoint frequency

Example:


 ThreadSpec config = ThreadSpec.builder()
     .name("search-thread")
     .quota(ResourceQuota.builder()
         .maxTokens(50000)
         .maxToolCalls(20)
         .build())
     .autoCheckpoint(true)
     .checkpointInterval(Duration.ofMinutes(5))
     .metadata("task", "web-search")
     .build();
 
Since:
0.0.2
  • Method Details

    • defaults

      public static ThreadSpec defaults()
      Create a default configuration.
    • shortLived

      public static ThreadSpec shortLived()
      Create a configuration for short-lived tasks.
    • longRunning

      public static ThreadSpec longRunning()
      Create a configuration for long-running tasks.
    • builder

      public static ThreadSpec.Builder builder()
    • getName

      public String getName()
    • getQuota

      public ResourceQuota getQuota()
    • isAutoCheckpoint

      public boolean isAutoCheckpoint()
    • getCheckpointInterval

      public Duration getCheckpointInterval()
    • isAutoResume

      public boolean isAutoResume()
    • getMaxRetries

      public int getMaxRetries()
    • getRetryDelay

      public Duration getRetryDelay()
    • getSpec

      public Map<String,Object> getSpec()
    • isInheritParentState

      public boolean isInheritParentState()
    • isPropagateExceptions

      public boolean isPropagateExceptions()
    • getSpec

      public <T> T getSpec(String key)
      Get a metadata value.
    • getSpec

      public <T> T getSpec(String key, T defaultValue)
      Get a metadata value with default.
    • toString

      public String toString()
      Overrides:
      toString in class Object