Skip to main content

Signals

Signals are custom metrics and feedback tied to your traces. Use them to track user satisfaction, quality scores, and any custom metrics relevant to your AI application.

What Are Signals?

Signals let you record:
  • User feedback - Thumbs up/down, star ratings
  • Quality metrics - Relevance, accuracy, helpfulness scores
  • Custom metrics - Any numeric, boolean, or categorical value
Signals are linked to traces, allowing you to correlate feedback with specific AI interactions.

Signal Types

TypeDescriptionExample Values
feedbackDirect user feedbackthumbs up, thumbs down
ratingNumeric ratings1-5 stars, 1-10 score
sentimentSentiment analysispositive, negative, neutral
qualityQuality assessment0.0-1.0 score
completionGoal completiontrue/false
customAny custom metricvaries

Signal Properties

PropertyTypeRequiredDescription
signalNamestringYesName of the signal
valueanyYesSignal value
traceIdstringNoLinks to a trace
spanIdstringNoLinks to specific span
agentNamestringNoAgent that generated signal
signalTypestringNoType categorization
sourcestringNouser, system, or llm
confidencenumberNoConfidence score (0-1)
reasoningstringNoExplanation for the value
metadataobjectNoAdditional context

Recording Signals

await foil.trace(async (ctx) => {
  // Do AI work...

  // Record user feedback
  await ctx.recordFeedback(true); // thumbs up

  // Record star rating
  await ctx.recordRating(4); // 4 out of 5 stars

  // Record custom signal
  await ctx.recordSignal('response_quality', 0.85, {
    signalType: 'quality',
    source: 'llm',
    confidence: 0.92
  });
});

Signal Sources

SourceDescription
userDirect user feedback
systemAutomated system metrics
llmLLM-based evaluation
Record multiple signals at once to reduce API calls:
await foil.recordSignalBatch([
  { signalName: 'relevance', value: 0.9, traceId: 'trace-123', signalType: 'quality' },
  { signalName: 'helpfulness', value: 0.85, traceId: 'trace-123', signalType: 'quality' },
  { signalName: 'goal_completed', value: true, traceId: 'trace-123', signalType: 'completion' }
]);
Full example: customer-support-agent — records feedback signals (thumbs up/down) on every conversation trace.

Best Practices

Standardize names across your application for better aggregation:
  • user_rating not rating, stars, score
  • response_quality not quality, resp_qual
When using LLMs to evaluate, always include a confidence score.

Next Steps