Astra DB Chat Memory
The Astra DB Chat Memory component lets you keep a record of all the messages in a conversation. It saves each chat message to a collection in Astra DB and can pull them back later, so your chatbot or AI assistant can remember what was said before.
How it Works
When you add this component to a workflow, it connects to your Astra DB account using the credentials you set up in Nappai.
- Collection Name – The name of the place in Astra DB where the messages will live.
- Namespace – (Optional) A sub‑folder inside the collection to keep things organized.
- Session ID – A unique identifier for the conversation; all messages with the same ID are grouped together.
The component does not run any extra actions on its own; it simply creates a memory object that other parts of your workflow can use to read or write chat history.
Inputs
Input Fields
- Collection Name: The name of the collection within Astra DB where the messages will be stored.
- Namespace: Optional namespace within Astra DB to use for the collection.
- Session ID: Session ID for the message.
Important: Before using this component, add an Astra DB API credential in the Credentials section of Nappai. Then select that credential in the component’s “Credential” field. The credential must contain:
- Astra DB Application Token
- Astra DB Api Endpoint
These credential fields are not shown in the Input Fields list because they are handled separately.
Outputs
- Memory: A
BaseChatMessageHistory
object that holds all the chat messages for the specified session. Other components can use this output to read past messages or add new ones.
Usage Example
-
Create a credential
In Nappai’s Credentials panel, add a new Astra DB API credential and paste your Application Token and Api Endpoint. -
Add the component
Drag the Astra DB Chat Memory component into your workflow. -
Configure the inputs
- Collection Name:
chat_history
- Namespace: (leave blank or set to
support
) - Session ID:
user_12345
- Credential: select the credential you created in step 1.
- Collection Name:
-
Connect to a chatbot
Pass the Memory output to a chatbot component so it can read previous messages and respond appropriately.
Related Components
- Chatbot – Uses the memory to generate context‑aware replies.
- LLM – The language model that processes the conversation.
- Memory Store – Other memory back‑ends you can compare with Astra DB.
Tips and Best Practices
- Keep the Collection Name short and consistent across workflows to avoid confusion.
- Use a Namespace if you have multiple projects that share the same collection name.
- Reuse the same Session ID for all messages in a single conversation so the history stays together.
- Store sensitive data (like tokens) only in credentials, never in plain text fields.
Security Considerations
- The component uses the Astra DB API token and endpoint stored in a credential, so make sure the credential is protected and only shared with trusted users.
- Avoid exposing the Session ID publicly if it could reveal personal or confidential information.
- Regularly rotate your Astra DB Application Token to maintain security.