> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/technical-reference/interfaces-and-conversations/chat-messages-conversations-and-session-identity.md).

# Chat Messages, Conversations, and Session Identity

A chat conversation contains related messages. Keep its identity consistent when the user continues a conversation, and separate it when they start a new one.

{% embed url="<https://1957915746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2F76LcEAMiUlASG51K78Fw%2Fchat-messages-conversations-and-session-identity.mp4?alt=media&token=89b01ed2-9e75-4bf9-9271-7d378a2bb3f0>" %}
A short walkthrough of chat messages, conversations, and session identity.
{% endembed %}

## Before you begin

A chat interface or supported API client with the required access.

## Key concepts

| Term          | Definition                                                                                                                                                                 |
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Conversation  | Related messages grouped into one interaction history. Several runs can belong to one conversation.                                                                        |
| Session       | A context maintained by an interface or browser for related activity. Its meaning depends on the feature; do not treat every session ID as a user credential.              |
| User identity | The authenticated person or application acting on a resource. It determines access; a display name or conversation ID does not authenticate a caller.                      |
| Run           | One execution of a project. Use its run ID to retrieve that execution’s state, input, output, and errors.                                                                  |
| Memory scope  | The project, node, and conversation context in which earlier exchanges can be reused. Keep unrelated users and conversations separate using the supported identity fields. |

## Maintain a conversation across messages

1. Start a conversation through the intended interface.
2. Retain its conversation identifier for related messages.
3. Start a separate conversation when the user requests a new context. Inspect run history for individual executions.

Messages remain associated with the intended conversation.

## Behavior and limitations

A conversation ID does not authenticate a user. Shared identifiers can mix context when memory is enabled. One message can create a separate workflow run, so conversation and run counts are different. Follow the selected interface’s supported identity configuration rather than inventing a user ID to bypass access checks.

## Related resources

[Interface Inputs and Output Mapping](https://docs.stackai.com/technical-reference/interfaces-and-conversations/interface-inputs-and-output-mapping.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.stackai.com/technical-reference/interfaces-and-conversations/chat-messages-conversations-and-session-identity.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
