# How can I restrict an AI Agent to answer only questions related to my forum?

**URL:** https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672
**Category:** Support
**Tags:** ai, ai-bot
**Created:** [August 10, 2026, 7:26am UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672 "2026-08-10T07:26:15Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [August 10, 2026, 7:26am UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/1 "2026-08-10T07:26:15Z")

</div>

I’m setting up Discourse AI on my forum and have an AI Bot/Agent working with **Gemini 2.5 Flash via LiteLLM and Google Vertex AI**.

The bot is working, but I have a problem with its scope.

For example, my forum is a business-focused community. If I ask the bot:

> “Who owns Uber?”

it answers the question using the LLM’s general knowledge, even though the question has nothing to do with my forum.

This creates two problems:

1. I want the bot to function as a **forum-specific knowledge assistant** , not as a general-purpose Gemini/ChatGPT interface.
2. I don’t want users to be able to ask arbitrary questions and consume my LLM credits.

What I would ideally like is:

User asks question  
↓  
Is it relevant to this forum?  
↓  
NO → politely refuse  
↓  
YES  
↓  
Search forum knowledge  
↓  
Generate answer based on forum content

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/e/c/cec980cbbbfa228461c06fa5cddde7b7413e4e04.png)

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [August 10, 2026, 8:32am UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/2 "2026-08-10T08:32:55Z")

</div>

Have you taken a look at Agents? Perhaps the Forum Researcher or Forum Helper Agents would be a better fit, as they are tuned to work with the forum specifically. Or is that what you are already using?

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [August 10, 2026, 9:31am UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/3 "2026-08-10T09:31:56Z")

</div>

Forum Helper also has this problem:

![image](https://global.discourse-cdn.com/meta/original/4X/4/6/a/46a49392aee895e6265b983e0b6400d7c8956dcc.png)

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [August 10, 2026, 10:58am UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/4 "2026-08-10T10:58:57Z")

</div>

Hmm… then perhaps you might want to make your own agent with a customized system prompt to not respond to queries outside of your forum’s scope.

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [August 10, 2026, 1:11pm UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/5 "2026-08-10T13:11:20Z")

</div>

Here’s what I see today if I try this on [ask.discourse.com](http://ask.discourse.com)

> Thanks for the question! Since you asked on a Discourse support channel, I’ll answer in the context of how language models power Discourse’s AI features — but let me know if you actually meant a general technical explanation of how LLMs work, and I can point you elsewhere for that.

Someone round here must know how that catch was made.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 10, 2026, 3:33pm UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/6 "2026-08-10T15:33:16Z")

</div>

The “Creative” agent you used in the test is our “no system prompt” agent, that just passes the request to the underlying LLM.

You will want to craft a new agent, with a system prompt that specifies how and when to answer on your own forum.

That’s what we did on [ask.discourse.com](http://ask.discourse.com) as mentioned by @Ed_S.

---

<div class="post-metadata">

### Author: ![Karthik\_K1](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/karthik_k1/32/489159_2.png) [@Karthik\_K1](https://meta.discourse.org/u/Karthik_K1)
#### Post date: [August 11, 2026, 3:21pm UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/7 "2026-08-11T15:21:22Z")

</div>

Although prompts can influence an agent’s behavior, they aren’t always reliable. I was able to trick the agent at [ask.discourse.com](http://ask.discourse.com) into answering a few off-topic questions.

 ![image](https://global.discourse-cdn.com/meta/original/4X/c/f/5/cf5af41678cc4b8a39cf4d9529576a8d2e3b0f57.png)

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [August 11, 2026, 4:24pm UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/8 "2026-08-11T16:24:35Z")

</div>

(This is probably one of those situations where 100% enforcement would cause more inconvenience than benefit. )

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 11, 2026, 4:47pm UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/9 "2026-08-11T16:47:12Z")

</div>

Yeah, after a conversation gets deep and you chain it, you can get it to keep on going. Not a worry for us as we host the models ourselves, so we don’t pay per token anyway. We also analyze all conversations on Ask daily and can ban any bad actors. The forum moderation flow is still the same.

If you want even more control than what the system prompt gives you, you can try some approaches:

### Workflows

Our new workflow plugin would allow you to do a 2-pass on every message, first with an agent evaluating if a message **should** be replied to, then another conditionally replying.

### Fine-tuned models

The most surefire way to control is to deploy a model that is actually trained with the behavior you want.

This is easy with Discourse AI, as we allow you to pick and choose LLMs for each agent.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [September 10, 2026, 4:47pm UTC](https://meta.discourse.org/t/how-can-i-restrict-an-ai-agent-to-answer-only-questions-related-to-my-forum/409672/10 "2026-09-10T16:47:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
