Skip to main content

sdac-store-feedback

Purpose

Stores user feedback (category, free-text comment, and optional numeric rating) for a specific SDAC agent response or full conversation. Uses a MERGE upsert -- re-submitting feedback for the same turn and user updates the existing row rather than inserting a duplicate.

Tool type

Deterministic (write / upsert)

Tool ID

sdac-store-feedback

Inputs

  • conversation_sk (number, required) -- conversationSK of the agent response being rated (from sdac-log-conversation-turn)
  • report_id (string, required, UUID) -- Cost report GUID
  • user_id (string, required) -- User identifier from authentication
  • session_id (string, required) -- Browser session ID
  • agent_id (string, required) -- Agent that produced the response
  • feedback_scope (response | conversation, default: response) -- Whether feedback applies to a single response or the full conversation
  • turn_number (number, required) -- Turn number of the rated response
  • rating (number, optional) -- Numeric rating on a 1-5 scale
  • category (accuracy | clarity | relevance | helpfulness | tone | other | null, required) -- Feedback category
  • comment (string, required) -- Free-text explanation (1-2000 characters)

Outputs

  • feedback_sk (number) -- Database primary key of the inserted or updated feedback record
  • success (boolean) -- Always true on success
  • message (string) -- Always "Feedback recorded"

Example output

{
"feedback_sk": 9021,
"success": true,
"message": "Feedback recorded"
}

Functional details

  • Uses a SQL MERGE upsert keyed on (ConversationSK, UserId) so duplicate submissions update in place.
  • rating is optional; a category and comment are sufficient.
  • feedback_scope: conversation is used when the user rates the overall session rather than a specific turn.

Usage notes

  • Pass the conversationSK returned by sdac-log-conversation-turn as conversation_sk.
  • Feedback is consumed by the Prompt Tuner workflow via sdac-read-feedback.

Implementation details

  • Writes to SDAC.fact_UserFeedback via insertOrUpdateFeedback in packages/domain-sdac/src/tools/feedback/.

Code Location: packages/domain-sdac/src/tools/store-feedback.tool.ts