Skip to main content
This page explains threads. After you read it, you know when to create a thread, what a thread holds, and what deleting a thread does. A thread is one conversation with an agent. Use one thread for each conversation, task, or user session. The agent uses the recent messages in the thread to understand the current message. The agent uses its whole memory to answer. A thread belongs to the subject that created it, and X-SP-End-User is what names that subject. Without the header your key is the organization, which owns the agent and reaches every thread on it. With the header you reach only the threads that person created; any other thread is a 404, exactly like a missing one. GET /v1/agents/{agent_id} returns a threads array already filtered that way, which is how you list one person’s conversations. There is no separate endpoint for it, and you do not need one.

Create a thread

Send POST /v1/agents/{agent_id}/threads.
Both fields are optional.

The success response

The status is 201. The thread is ready at once.

Errors

Read, change, and delete a thread

All three calls can return 503 service_unavailable with the message “This thread is temporarily unavailable” for a few seconds after a restart. Wait, then send the request again.

What a thread is not

A thread is not a separate memory. When you delete a thread, the agent still remembers what it learned from that thread. If two of your customers must not share a memory, give them two agents. The header separates conversations inside one agent; it does not separate memory.