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. Every call appends a new row so repeated or revised submissions remain available as separate evidence.

Tool type

Deterministic (append-only write)

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 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 INSERT; there is no (ConversationSK, UserId) unique constraint and no update-in-place behavior.
  • rating is optional; a category and comment are sufficient.
  • feedback_scope is accepted by the tool schema for caller intent but is not currently passed into insertFeedback() or stored in SDAC.fact_UserFeedback.

Usage notes

  • Pass the conversationSK returned by sdac-log-conversation-turn as conversation_sk.
  • Although the tool schema accepts an omitted rating, the deployed SQL table currently declares Rating as NOT NULL; callers should supply a 1-5 rating until those contracts are reconciled.
  • Feedback is consumed by the Prompt Tuner workflow via sdac-read-feedback.

Implementation details

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

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