Skip to content
Talk to an engineer

SDK APIs

Conversation

Manage a user’s conversations with your agent: fetch and search them, pin the important ones, and rename, delete, or select a conversation by ID.

Fetch conversations with pagination, search, and filtering. The three arguments are positional, not a single options object.

getConversations(
pagination?: { pageNumber: number; pageSize: number },
search?: { value: string },
filters?: { pinned?: boolean },
): any;
foldspace.agent('AGENT_NAME').getConversations(
{ pageNumber: 1, pageSize: 20 },
{ value: 'invoice' },
{ pinned: true }
);
ParameterTypeDescription
pagination.pageNumbernumberPage to fetch. Defaults to 1; values below 1 are raised to 1.
pagination.pageSizenumberConversations per page. Defaults to 20, and is capped at 20.
search.valuestringFree-text search filter.
filters.pinnedbooleanRestrict results to pinned conversations.

Get the name (title) of a conversation by ID.

getConversationName(conversationId: string): string | undefined;
foldspace.agent('AGENT_NAME').getConversationName('CONVERSATION_ID');

Pin or unpin a conversation by ID. Neither returns the agent instance, so they cannot be chained.

pinConversation(conversationId: string): void;
unpinConversation(conversationId: string): void;
foldspace.agent('AGENT_NAME').pinConversation('CONVERSATION_ID');
foldspace.agent('AGENT_NAME').unpinConversation('CONVERSATION_ID');

Rename or delete a conversation by ID. Neither returns the agent instance, so they cannot be chained.

renameConversation(conversationId: string, name: string): void;
deleteConversation(conversationId: string): void;
foldspace.agent('AGENT_NAME').deleteConversation('CONVERSATION_ID');
foldspace.agent('AGENT_NAME').renameConversation('CONVERSATION_ID', 'NEW_NAME');

Make a conversation the active one by ID. Returns the agent instance, so it can be chained.

selectConversation(conversationId: string): this;
foldspace.agent('AGENT_NAME').selectConversation('CONVERSATION_ID');