CorfedoCorfedoDocs

Conversations

Create and continue API conversations, page through their history and delete them.

A conversation stores messages and their runs in Corfedo. Start one by omitting conversationId from a message. Continue by sending a new message with the returned ID and a new clientMessageId.

const first = await client.ai.send({
  clientMessageId: crypto.randomUUID(),
  text: 'Where are search queries parsed?',
});
if (first.status !== 'ended') throw new Error('Follow the first run before continuing');

const next = await client.ai.send({
  conversationId: first.conversationId,
  clientMessageId: crypto.randomUUID(),
  text: 'Which modules call that parser?',
});

Only one run can be active in a conversation. Sending another message while it is active returns conversation_busy. A run waiting for client tools still occupies the conversation. Return its tool results or cancel it before starting another message.

Read history

const page = await client.ai.listConversations({ limit: 20 });
for (const item of page.conversations) console.log(item);
if (page.nextCursor) {
  const nextPage = await client.ai.listConversations({ limit: 20, cursor: page.nextCursor });
}

const history = await client.ai.getConversation(first.conversationId, { limit: 20 });
console.log(history);

The list is ordered by most recent activity. Pass the opaque nextCursor back as cursor. Conversation reads return messages with their runs, outcomes, final answers and citation maps. To read earlier messages, pass earlierBeforeOrdinal back as beforeOrdinal. See the list and read schemas for bounds.

Source boundaries

The API lists, reads and deletes only API conversations available to the caller. Web and Slack conversations continue in their own channels. Sending a message to another source returns other_source. Reading, deleting, reattaching to or cancelling a Web or Slack conversation's run through this API returns not_found.

Delete

await client.ai.deleteConversation(first.conversationId);

The delete endpoint returns HTTP 204 on success. Use the CLI conversation commands for terminal access.

On this page