[GH-ISSUE #5060] [BUG]: Agent interactions (@agent) are not persisted to thread history via API #4892

Open
opened 2026-06-05 14:50:43 -04:00 by yindo · 0 comments
Owner

Originally created by @Stensan on GitHub (Feb 24, 2026).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5060

How are you running AnythingLLM?

AnythingLLM desktop app

What happened?

When sending a chat request to the /v1/workspace/{slug}/thread/{threadSlug}/chat endpoint using the @agent trigger, the interaction (both prompt and response) is not saved to the thread history.

This issue breaks the continuity of the conversation when using AnythingLLM as a backend for custom applications, as the "memory" of the thread is lost for future interactions if those interactions were handled by the agent.

While the agent successfully executes its tasks and returns a response in the API call, the messages do not appear in the desktop UI for that thread, nor are they returned when fetching history via /v1/workspace/{slug}/thread/{threadSlug}/chats.

Steps to Reproduce

  • Create a workspace and a specific thread.
  • Send a POST request to /v1/workspace/{slug}/thread/{threadSlug}/chat with the message prefixing @agent (e.g., "message": "@agent search the customer database for...").
  • Observe that the API returns a valid response from the agent.
  • Check the thread history in the AnythingLLM Desktop App or via the /chats API endpoint.
  • Result: The thread remains empty or missing the agent interaction.

Expected Behavior
Every interaction sent to a specific threadSlug should be persisted to the database and visible in the chat history, regardless of whether the @agent mode was triggered or a standard LLM response was generated.

Actual Behavior

  • Standard chats (without @agent): Saved correctly in history.
  • Agent chats (with @agent): Processed successfully but completely missing from the history/database.

Environment

  • AnythingLLM desktop app v1.10.0
  • LLM Provider: Google Gemini

Are there known steps to reproduce?

No response

Originally created by @Stensan on GitHub (Feb 24, 2026). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/5060 ### How are you running AnythingLLM? AnythingLLM desktop app ### What happened? When sending a chat request to the /v1/workspace/{slug}/thread/{threadSlug}/chat endpoint using the @agent trigger, the interaction (both prompt and response) is not saved to the thread history. This issue breaks the continuity of the conversation when using AnythingLLM as a backend for custom applications, as the "memory" of the thread is lost for future interactions if those interactions were handled by the agent. While the agent successfully executes its tasks and returns a response in the API call, the messages do not appear in the desktop UI for that thread, nor are they returned when fetching history via /v1/workspace/{slug}/thread/{threadSlug}/chats. Steps to Reproduce - Create a workspace and a specific thread. - Send a POST request to /v1/workspace/{slug}/thread/{threadSlug}/chat with the message prefixing @agent (e.g., "message": "@agent search the customer database for..."). - Observe that the API returns a valid response from the agent. - Check the thread history in the AnythingLLM Desktop App or via the /chats API endpoint. - Result: The thread remains empty or missing the agent interaction. Expected Behavior Every interaction sent to a specific threadSlug should be persisted to the database and visible in the chat history, regardless of whether the @agent mode was triggered or a standard LLM response was generated. Actual Behavior - Standard chats (without @agent): Saved correctly in history. - Agent chats (with @agent): Processed successfully but completely missing from the history/database. Environment - AnythingLLM desktop app v1.10.0 - LLM Provider: Google Gemini ### Are there known steps to reproduce? _No response_
yindo added the enhancementbugcore-team-only labels 2026-06-05 14:50:43 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#4892