API Reference
reportOutcome()
API reference for reporting task outcomes.
Method Signature
amp.reportOutcome(params: OutcomeParams): Promise<void>Parameters
interface OutcomeParams {
// Required
requestId: string; // From getContext() response
started: boolean; // Did user start the task?
// Optional
completed?: boolean; // Did they complete it?
timeToStart?: number; // Seconds until started
flowState?: boolean; // Were they engaged?
satisfaction?: number; // User feedback (0-1)
metadata?: Record<string, any>;
}Examples
Successful Completion
await amp.reportOutcome({
requestId: context.requestId,
started: true,
completed: true,
timeToStart: 15,
flowState: true,
satisfaction: 0.95
});User Never Started
await amp.reportOutcome({
requestId: context.requestId,
started: false,
completed: false
});Started But Not Completed
await amp.reportOutcome({
requestId: context.requestId,
started: true,
completed: false,
timeToStart: 120
});Error Codes
INVALID_REQUEST_ID- Request ID not foundOUTCOME_ALREADY_REPORTED- Outcome already reported for this requestREQUEST_EXPIRED- Request ID older than 24 hours
⚠️ Important: Always report outcomes, even negative ones. Skipping bad outcomes prevents AMP from learning.