@personaai/sdkv0.9.0

threads — @personaai/sdk

Generated field tables for threads — do not edit

Generated from sdk/typescript/dist/typedoc.json — do not edit. Regenerate with node platform/scripts/typedoc-resources.mjs.

threads

Auth: Requires Authorization: Bearer <keyId>.<secret> (server-side). For per-user calls add x-persona-external-user-id. See .

Threads scope messages, files, todos, and checkpoints to one conversation. Use externalUserId so threads belong to your user.

Example

TypeScript

ts
const userClient = new PersonaClient({ baseUrl, credential, externalUserId: currentUser.id });const thread = await userClient.threads.create({ agentId: agent._id });for await (const e of userClient.chat.stream(agent._id, { messages: [{ role:'user', content:'Hi' }], threadId: thread._id })) {}

cURL

bash
curl https://api.persona.hasanraiyan.me/api/v1/developer/threads \  -H "Authorization: Bearer $PERSONA_CREDENTIAL" -H "x-persona-external-user-id: user_123" \  -H "Content-Type: application/json" -d '{"agentId":"ag_123"}'

Response

json
{  "success": true,  "data": { "_id": "th_123", "agentId": "ag_123", "title": "New chat" }}

Thread

Like Skill/Agent/Knowledge/Mcp, this mirrors the real wire shape (_id).

Source: types/thread.ts:4

Interface

FieldTypeDescription
_idstring— _ types/thread.ts:5_
domainstring— _ types/thread.ts:6_
agentIdstring | { _id: string; name: string; avatar: string; slug: string }Populated as { _id, name, avatar, slug } on list(); a bare id on create()/get(). — _ types/thread.ts:8_
subjectType"PersonaUser" | "ExternalUser"— _ types/thread.ts:9_
userId?string— _ types/thread.ts:10_
externalUserId?string— _ types/thread.ts:11_
threadIdstringThe deterministic AG-UI thread id used for streaming (x-thread-id) — distinct from _id. — _ types/thread.ts:13_
titlestring— _ types/thread.ts:14_
lastMessageAtstring— _ types/thread.ts:15_
isArchivedboolean— _ types/thread.ts:16_
subagentTraces?Record<string, unknown>— _ types/thread.ts:17_
createdAtstring— _ types/thread.ts:18_
updatedAtstring— _ types/thread.ts:19_

CreateThreadInput

Source: types/thread.ts:22

Interface

FieldTypeDescription
agentIdstringThe Agent this Thread's conversation is with. — _ types/thread.ts:24_

UpdateThreadInput

All fields optional — only what you pass is changed.

Source: types/thread.ts:28

Interface

FieldTypeDescription
title?string— _ types/thread.ts:29_
isArchived?boolean— _ types/thread.ts:30_

ListThreadsParams

Source: types/thread.ts:33

Interface

FieldTypeDescription
page?number— _ types/thread.ts:35_
limit?number— _ types/thread.ts:37_

ThreadMessages

messages holds raw LangChain message objects (role/content/tool_calls vary by message type) — intentionally untyped rather than guessing at a shape this SDK doesn't own.

Source: types/thread.ts:45

Interface

FieldTypeDescription
messagesunknown[]— _ types/thread.ts:46_
stateRecord<string, unknown>— _ types/thread.ts:47_
subagentTracesRecord<string, unknown>— _ types/thread.ts:48_
pendingInterrupt?ChatInterruptSet when this Thread is currently paused on a HITL/clarification interrupt — lets a caller re-show the approval/clarification card on page load without waiting for the next live chat.stream() call to re-surface it. Same shape as ChatResult.interrupt. Named pendingInterrupt (not interrupt) to match the actual wire field checkpointService.getMessages() returns. — _ types/thread.ts:57_