Repository navigation
Chat User Instructions for Chat Completions Not Being Sent to LLM with context_agent enabled #338
Description
Which version of integration_openai are you using?
3.7.1
Which version of Nextcloud are you using?
NC Hub 10 31.0.7
Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.
Vivaldi
Describe the Bug
The Chat User Instructions for Chat Completions setting is not being passed to configured LLM. The following task printouts show there is no 'system prompt' which should be included per the User Instruction setting.
Here is the specific instruction I set for before each test request.
Then I ran these test requests. I see that any query to the Chat with AI mode in NC Assistant creates at least 2 tasks. I believe this is to account for tool calling when supported. Also note that no request has any 'system prompt' included.
Request 1 Task:
- id: 10929
- type: core:contextagent:interaction
- lastUpdated: 1754668023
- status: STATUS_SUCCESSFUL
- userId: rockyreidel
- appId: assistant:chatty-llm
- input:
- input: What is your name?
- confirmation: 0
- conversation_token: {}
- output:
- output: My name is Assistant. How can I assist you today?
- conversation_token: ...
- actions:
- sources:
- customId: chatty-llm:50
- completionExpectedAt: 1754668075
- progress: 1
- scheduledAt: 1754668015
- startedAt
- endedAt: 1754668023
- error_message
- 1:
- id: 10930
- type: core:text2text:chatwithtools
- lastUpdated: 1754668020
- status: STATUS_SUCCESSFUL
- userId: rockyreidel
- appId: context_agent
- input:
-
system_prompt:
You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools! If you used a tool, you still need to convey its output to the user.
Use the same language for your answers as the user used in their message.
Today is 2025-08-08.
Detect the language the user is using. Reply in the detected language. Do not output the detected language.
Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found.
You can check which calendars exist using the list_calendars tool, if a calendar can not be found.
you can find out a user's email address and location by using the find_person_in_contacts tool.
you can find out the current user's location by using the find_details_of_current_user tool.
If an item should be added to a list, check list_calendars for a fitting calendar and add the item as a task there. -
input: What is your name?
-
tool_message:
-
history: ...
-
- output: -
output: My name is Assistant. How can I assist you today?
-
tool_calls:
-
- customId:
- completionExpectedAt: 1754668036
- progress: 1
- scheduledAt: 1754668018
- startedAt: 1754668018
- endedAt: 1754668020
- error_message
Request Task 2:
0:
- id: 10935
- type: core:contextagent:interaction
- lastUpdated: 1754668352
- status: STATUS_SUCCESSFUL
- userId: rockyreidel
- appId: assistant:chatty-llm
- input:
- input: What is your name? What is the color of the sky?
- confirmation: 0
- conversation_token: {}
- output:
- output: My name is Assistant. The color of the sky is generally blue during the day and changes to shades of orange, pink, and red during sunrise and sunset, depending on weather and atmospheric conditions.
- conversation_token: ....
- - actions:
- sources:
- customId: chatty-llm:51
- completionExpectedAt: 1754668403
- progress: 1
- scheduledAt: 1754668343
- startedAt
- endedAt: 1754668352
- error_message
- 1:
- id: 10936
- type: core:text2text:chatwithtools
- lastUpdated: 1754668349
- status: STATUS_SUCCESSFUL
- userId: rockyreidel
- appId: context_agent
- input:
-
system_prompt:
You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools! If you used a tool, you still need to convey its output to the user.
Use the same language for your answers as the user used in their message.
Today is 2025-08-08.
Detect the language the user is using. Reply in the detected language. Do not output the detected language.
Only use the duckduckgo_results_json tool if the user explicitly asks for a web search.
You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found.
You can check which calendars exist using the list_calendars tool, if a calendar can not be found.
you can find out a user's email address and location by using the find_person_in_contacts tool.
you can find out the current user's location by using the find_details_of_current_user tool.
If an item should be added to a list, check list_calendars for a fitting calendar and add the item as a task there. -
input: What is your name? What is the color of the sky?
-
tool_message:
-
history:.....
-
- output: -
output: My name is Assistant. The color of the sky is generally blue during the day and changes to shades of orange, pink, and red during sunrise and sunset, depending on weather and atmospheric conditions.
-
tool_calls:
-
- customId:
- completionExpectedAt: 1754668364
- progress: 1
- scheduledAt: 1754668346
- startedAt: 1754668347
- endedAt: 1754668349
- error_message
Any other settings I should troubleshoot to find the reason why this setting is not being passed correctly?
Expected Behavior
The setting from Chat User Instructions for Chat Completions in the Admin Settings > Artificial Intelligence should be included in the requests to the LLM
To Reproduce
Change setting Chat User Instructions for Chat Completions
Send test request to LLM
Review task process if a system prompt was included or not

Activity
[-]Chat User Instructions for Chat Completions Not Being Sent to LLM[/-][+]Chat User Instructions for Chat Completions Not Being Sent to LLM with context_agent enabled[/+]kyteinsky commentedon Aug 11, 2025
transferring this issue to the assistant repo for possible resolution
janepie commentedon Jan 16, 2026
Hello! The system prompt for Context Agent is actually a different one than we use without it as it includes instructions for tool calling, leaving it open for admins to change is not really a good idea. We could think about a way of including some extra instructions to be included, I will come back to you on that.
vyacheslavhulyaev-glitch commentedon Oct 21, 2026
Hi @julien-nc @janepie 👋
I've looked into this. Here's what I found and what I'd suggest before I start on PRs.
Cause
When Context Agent is available, ChatService::scheduleMessageGeneration() sends the request through scheduleAgencyTask /
scheduleAgencyMultimodalTask / scheduleAgencyAudioTask. Those only send input, confirmation, conversation_token and memories. The session's system
message, which holds the "Chat User Instructions", is only read in the classic chat branch. On the Context Agent side, agent.py builds its system
prompt from fixed text and has no input for extra instructions.
Proposal (no server change needed)
Following @janepie's point that the agent's own prompt shouldn't be replaceable, admins could add instructions to it instead of overriding it:
multimodal provider.
(follow them unless they conflict with the rules above)". The tool-calling rules stay intact.
optionalInputShape['user_instructions'] is available. That's the same check as for memories, so older Context Agent versions keep working.
Questions
default text doesn't contradict the agent prompt, so reusing it looks safe to me.
something only this provider declares?
If this direction sounds right, I'll open two PRs (context_agent and assistant) that link to each other.
fix: support additional user instructions in the system prompt
fix(chat): pass the chat user instructions to the Context Agent
vyacheslavhulyaev-glitch commentedon Oct 21, 2026
Both PRs are ready for review:
user_instructionsinput and appends it to the agent's system promptTested on Nextcloud 35.0.2 with a real model: with "Always answer like a pirate" in the admin settings, agentic chat now follows the instructions.
Two points I'd like your opinion on:
Happy to adjust anything.
julien-nc commentedon Oct 22, 2026
@vyacheslavhulyaev-glitch About your questions:
vyacheslavhulyaev-glitch commentedon Oct 22, 2026
@julien-nc thanks! The audio part is in both PRs now (new
output_modeinput), more details in #709.