Interface FeedbackCollector


public interface FeedbackCollector
SPI for collecting and learning from tool execution feedback.

When discovered via FeedbackCollector.Factory.discover(), the agent automatically:

  • Records tool execution outcomes (success/failure/latency)
  • Accepts explicit user feedback (corrections, preferences)
  • Provides learned preferences for prompt augmentation

If tnsai-intelligence is not on the classpath, the agent operates without feedback collection (graceful degradation).

Implementation is provided by tnsai-intelligence module.

Since:
0.1.0
See Also:
  • Method Details

    • noOp

      static FeedbackCollector noOp()
      Returns a no-op implementation that silently ignores all operations. Used as a null-object when tnsai-intelligence is not on the classpath.
      Returns:
      a no-op FeedbackCollector (singleton)
    • recordToolOutcome

      void recordToolOutcome(FeedbackCollector.ToolOutcome outcome)
      Records the outcome of a tool execution. Called automatically by the agent after each tool call.
      Parameters:
      outcome - the tool execution outcome
    • recordUserFeedback

      void recordUserFeedback(String type, String content, Map<String,Object> metadata)
      Records explicit user feedback (thumbs up/down, correction, preference).
      Parameters:
      type - feedback type (POSITIVE, NEGATIVE, CORRECTION, PREFERENCE)
      content - the feedback content
      metadata - optional metadata (tool name, session id, etc.)
    • getLearnedPreferences

      List<String> getLearnedPreferences()
      Returns learned preferences from accumulated feedback. Used by the agent to augment the system prompt.
      Returns:
      list of preference strings (never null, may be empty)
    • getPromptAdjustments

      List<String> getPromptAdjustments()
      Returns prompt adjustments derived from corrections and negative feedback. Used by the agent to augment the system prompt.
      Returns:
      list of prompt adjustment rules (never null, may be empty)
    • getFeedbackCount

      int getFeedbackCount()
      Returns the number of recorded feedback items.
      Returns:
      feedback count