The FutureAGI JavaScript/TypeScript SDK provides two primary classes: Annotation for logging annotations via a DataFrame-style interface, and AnnotationQueue for full queue lifecycle management.
The AnnotationQueue class provides complete programmatic control over the annotation queue lifecycle: creating queues, adding items, assigning work, submitting annotations, and exporting results.
// Activate a draft queueawait queues.activate(queue.id);// Mark a queue as completedawait queues.completeQueue(queue.id);// Add or remove labels from a queueawait queues.addLabel(queue.id, 'label_789');await queues.removeLabel(queue.id, 'label_789');// List items with optional status filterconst items = await queues.listItems(queue.id, { status: 'pending' });// Assign items to a specific userawait queues.assignItems(queue.id, ['item_1', 'item_2'], 'user_123');// Complete or skip itemsawait queues.completeItem(queue.id, 'item_1');await queues.skipItem(queue.id, 'item_2');
Use logAnnotations() for bulk SDK-based annotation — The DataFrame-style format is the fastest way to annotate many spans at once.
Use AnnotationQueue for programmatic queue management — Create, assign, and complete queues entirely from code.
Use createScore() / createScores() for direct score creation — Bypass the queue workflow when you need to attach scores to traces directly.
Always handle errors — Check for partial failures in bulk operations. Both logAnnotations and addItems can succeed for some records and fail for others.
Use TypeScript — All SDK methods are fully typed. TypeScript catches column name typos and invalid configurations at compile time.
Bulk operations (logAnnotations, addItems, createScores) may partially succeed. Always inspect the response for per-record errors before assuming all records were processed.