Core Concepts
Memory & Context
Meebly agents maintain conversation context across sessions using thread-based memory and customer-scoped tracking. They remember your customers and the history of their interactions, enabling personalized and coherent cross-session conversations.
Thread-Based Memory
Every conversation is stored in a thread. When you start a chat, a unique threadId is returned in the complete event. Include this threadId in subsequent requests to continue the conversation.
// First message
POST /v1/chat
{
"agentId": "agent_abc123",
"environmentId": "env_xyz789",
"messages": [{"content": "Hello"}]
}
// Complete event returns threadId
{
"type": "complete",
"data": {
"text": "Hi! How can I help you?",
"threadId": "thread_def456"
}
}
// Continue conversation with threadId
POST /v1/chat
{
"agentId": "agent_abc123",
"environmentId": "env_xyz789",
"threadId": "thread_def456",
"messages": [{"content": "I need help with my order"}]
}Continuing Conversations
The agent remembers the full conversation history when you provide a threadId. This enables:
- Follow-up questions without repeating context
- Multi-turn problem solving
- Personalized responses based on conversation history
- Maintaining context across page refreshes
Customer-Scoped Memory
Use the customerId parameter to track which user is chatting. This enables:
- Analytics per user
- User-specific conversation history
- Personalized agent behavior
- Usage tracking and billing
{
"agentId": "agent_abc123",
"environmentId": "env_xyz789",
"messages": [{"content": "What's my order status?"}],
"customerId": "customer_789", // Your user identifier
"threadId": "thread_def456"
}Best Practices
Always Save Thread IDs
Capture the threadId from every complete event and store it. Don't rely on users to maintain context - do it for them.
Use Customer IDs Consistently
Pass the same customerId for the same user across all their conversations to enable proper tracking and analytics.
Start Fresh When Appropriate
Omit threadId to start a new conversation when context should reset (e.g., after completing a task or switching topics).