Class ActivityBlock

java.lang.Object
com.tnsai.integration.activity.ActivityBlock

public final class ActivityBlock extends Object
Renders an agent's AgentActivity as the block its LLM reads: one line per entry, oldest first, written to the agent in the second person.

Peers are named by the function the caller passes, so the block names them the way the rest of the agent's prompt does; those names are rendered as the function gives them, neither redacted nor cut short. Every line is kept on one line: a line break or a separator control character (U+001C to U+001E) in a text, a peer's name or a type is rendered as a space, so what an entry carries cannot start a line of its own. A text that was cut short ends with " [cut]".

Since:
0.18.5
  • Method Details

    • render

      public static <P> String render(List<? extends AgentActivity.Entry<P>> entries, Function<? super P,String> name)
      Renders entries as the block.
      Type Parameters:
      P - how the record identifies a peer
      Parameters:
      entries - the record's entries, oldest first
      name - names a peer; a null name falls back to String.valueOf(peer)
      Returns:
      the block, ending with a line break, or the empty string when there are no entries
      Throws:
      NullPointerException - if entries or name is null
      Since:
      0.18.5