Skip to main content
persona.threads — /api/v1/developer/threads. A Thread is a named, listable conversation between one of your end users and one Agent. Every call here requires the client to have been constructed with externalUserId set — a bare Project credential has no Subject to scope a conversation to, and the server rejects it with 400 EXTERNAL_USER_REQUIRED (PersonaValidationError).

Do you need Threads at all?

No — you don’t have to create one before chatting. chat.sendMessage()/chat.stream() create an implicit deterministic Thread automatically (one conversation per Agent per user). Call threads.create() only when you want an explicit, listable Thread up front — e.g. so the user can see and resume past conversations by name.

Methods

create(input, idempotencyKey?)

  • input is just { agentId }.
  • Returns the created Thread (raw Mongo shape — _id). On create(), threadId on the response is the deterministic AG-UI thread id used for streaming (x-thread-id) — distinct from _id. Pass it to chat.stream()/chat.sendMessage() via options.threadId to resume this named conversation.

list(params?)

Lists the asserted external user’s own Threads, most recently active first. page (default 1), limit (default 20). Note: on list(), each item’s agentId is populated as { _id, name, avatar?, slug } — unlike create()/get(), which return a bare id string.

get(threadId)

Fetches one Thread by _id.

update / updateTitle

  • update(threadId, { title?, isArchived? }) is the general form — send just the one you want to change. updateTitle(threadId, title) is a convenience wrapper over it.

getMessages(threadId)

Fetches the full message history + graph state for a Thread — the same data chat.stream() would resume from.
Returns ThreadMessages: { messages: unknown[], state: Record<string, unknown>, subagentTraces: Record<string, unknown> }. messages holds raw LangChain-style message objects (role/content/ tool_calls vary by message type) and is intentionally typed unknown[] — inspect at runtime if you need to render history yourself, or prefer chat.stream()’s typed AG-UI events for anything you’re building a live UI around.

delete / bulkDelete

  • delete(threadId) deletes the Thread and its message history.
  • bulkDelete(ids) — best-effort, up to 100 ids per call.

Complete example