Recommended patterns for performance, privacy, and user experience
Following these best practices will help you build a high-quality, compliant, and efficient integration with the VKRA API.
VKRA is designed to be privacy-first. Your integration should reflect this.
session_id, ensure it is an anonymous UUID that cannot be traced back to a specific user's identity outside of your system.AI agents require low-latency responses. Here's how to keep your integration fast.
Contextual recommendations should enhance, not interrupt, the user flow.
relevance_explanation field to help your agent explain why a product is being recommended.min_relevance_score to filter out products that don't meet your quality bar. A high threshold (e.g., 0.7) ensures only highly relevant products are shown./clicks endpoint for every user interaction. This is required for your revenue tracking.last_updated_at field. If pricing or availability data is more than 24 hours old, consider re-fetching.url provided in the AdResponse as the final destination for the user click.Implement robust error handling with graceful fallbacks.
try {
const ads = await fetchAds(context);
renderAds(ads);
} catch (error) {
// Gracefully handle failure - the agent should still function
console.error("VKRA not available", error);
renderAlternativeContent();
}