https://discord.gg/botpress logo
DOS protection
# 🤝help
f
Is there a way to limit the number of LLM requests a single user / ip address can trigger to prevent abuse? Is there any kind of denial of service protection in place on botpress side?
l
Botpress does not expose a per‑user/IP quota. Some features are gated to the "Team Plan" You can read more on preventing abuse here: https://botpress.com/docs/studio/guides/advanced/safety/preventing-abuse#preventing-abuse
f
it seems there is also no way to imlement this within a workflow on our own because within a hook i cannot trigger a transition to another node
w
you can very easily using an expression
you can set variables using your hook and use those variables to transition
f
but then the ai has to decide to transition. I dont want to rely on Ai for such things.
w
the expression is code based
so if abuse = true then abuse is true
no need for llm interference
f
Does this mean if I add a code card to an autonumous node its always executed and not triggered via the LLM? I don't think this is documented anywhere.
w
apologies, i didn't realize you were using the AN
i don't have much experience with it, but i imagine passing that same variable value as "Transition" and turning on "force thinking" should achieve a similar result
f
yes this I think is the problem. Because I did not find a way to transition away from the AN without relying on the LLM itself, and I think this would be quite unprofessional
but thanks for the discussion
w
is the user stuck on the autonomous agent for the duration of the conversation?
that is, is "allow conversation" enabled
f
its more about users which are abusing our chat too much, and we want to force close the conversation for them
w
do you have any mechanic for detecting abuse in mind?
f
for now applying a message limit would be enough
w
conversations come with a messageCount attribute
so that seems simple enough
if your entire workflow isn't a single an, then you can use the method i mentioned
also the "relying on the llm too much" isn't too big of a problem if you're using a good enough llm
f
is the entire workflow run for every message? or is the position in the workflow persisted accross messages? maybe its a misunderstanding on my side. But I thought it the latter. So then I would be stuck in the AN.
w
the user's position in the workflow persists until they time out
but it depends on your bot architecture - do you have a single autonomous node handling everything?
i'm sure there's a way to force the AN to call a transition, i'm just not sure how due to lack of experience unfortunately
f
no we have some steps which happen before the user reaches the AN and there are also actions which the AN can trigger
w
so the problem is abuse in the AN right
f
yes exactly
what would be nice is if a hook could just trigger a transition, but since this is not possible I guess I have to tell the LLM to trigger the transition in such a case
w
i think it's possible... but it's gonna be tricky finding how exactly
i'll take a look though
@future-notebook-73286 might've found a way
the autonomous nodes call LLMz for generation and such
so if you can set the abuse flag with a hook, for example the messageCount one
you can use a
before_llmz_execution
hook to get the `context`object from LLMZ.CreateContext
that has the entire autonomous node system prompt, which includes a section giving the bot actions
explicitly `**Important**:
action
can only be one of: 'listen', 'think', 'Standard1'`
"Standard1" in this case is the transition you want to force
so you would mutate the context to remove listen and think, leaving only Standard1
which would force the returnal of the Standard1 transition exit
in a way this still relies in the LLM, but much less
alternatively i guess you could just mutate
status
with a body like this
Copy code
javascript
"status": {
          "type": "exit_success",
          "exit_success": {
            "exit_name": "Standard1",
            "return_value": {}
Standard1 replaced of course with your actual transition
f
ok thanks for the input. quite hidden stuff there 🙂
w
there really is haha i wish there was more documentation on the client and other stuff under the hood
13 Views