Record and replay chat conversations in your chatbot app. Helps you understand where your chatbot falls short and how to improve it.Chats integrate seamlessly with traces by reconciliating messages with LLM calls and agents.You can record chats in the backend or directly on the frontend if it’s easier for you.
To take full advantage of Lunary’s tracing capabilities, you can reconcile your LLM and agents runs with the messages.We will automatically reconciliate messages with runs.
If you’re using LangChain or agents behind your chatbot, you can inject the current message id into context as a parent:
Copy
const msgId = thread.trackMessage({ role: "user", content: "Hello!" });// In your backend, inject the message id into the contextconst agent = lunary.wrapAgent(function ChatbotAgent(query) { // your custom code...});await agent("Hello!").setParent(msgId);
Note that it’s safe to pass the message ID from your frontend to your backend, if you’re tracking chats directly on the frontend for example.