useAgentThreadAssignments() hook
useAgentThreadAssignments() reads the assignment feed for one thread. It is useful for coordinator and review surfaces where you need the ordered assignment list without the larger task board item surface.Usage
The following example shows a basic usage of useAgentThreadAssignments().
import { useAgentThreadAssignments } from '@wacht/nextjs';export default function ThreadAssignments({ threadId,}: { threadId: string;}) { const { assignments } = useAgentThreadAssignments(threadId, { enabled: !!threadId, }); return ( <ul> {assignments.map((assignment) => ( <li key={assignment.id}>{assignment.assignment_role}</li> ))} </ul> );}Return value
The hook returns the following fields and methods.
›assignments?: ProjectTaskBoardItemAssignment[] | undefined;
assignments?: ProjectTaskBoardItemAssignment[] | undefined;Flattened assignment list for the thread.
›id?: string | undefined;
id?: string | undefined;Assignment identifier.
›assignment_role?: string | undefined;
assignment_role?: string | undefined;Role this assignment plays in the task flow.
›assignment_order?: number | undefined;
assignment_order?: number | undefined;Execution order for the assignment.
›status?: string | undefined;
status?: string | undefined;Current assignment status.
›result_status?: string | undefined | undefined;
result_status?: string | undefined | undefined;Outcome status when the assignment has completed.
Overview
Like
useAgentThreadEvents(), this is a paged read-only list. It is focused on the assignment history and current assignment state that the thread participates in.