Prompt Fuzzer: how to keep your agents on the right path
Tags: ai, opensource, security
Published: 2024-05-20 07:00:00

Good morning everyone and happy MonDEV! ☕

How are your coding experiments going? I hope everything is going well and that your inspiration is always abundant!

In the past few weeks, during my wanderings through the various tools on the web, I have come across many tools related to the world of AI; not that it surprises me, being a bit of a hot topic at the moment, but recently I have found more than usual and also some interesting ones, so it's obvious that it will be a recurring topic on our Monday mornings!

I am actually thinking of creating a curated list of the AI tools I have found, so that they can all be easily retrieved in an organized way, for any need. What do you think, would you be interested? Let me know! 😉

Meanwhile, let's go and see today's tool, belonging to this world.

Among the various proposals we have seen tools to interface with LLMs, others that allow the easy creation of agents (and we will soon return to the topic), and also extensions that integrate LLM models with the browser (before it became mainstream).

However, there is a topic we have never touched upon, that is the security of prompts. Indeed, those who are a bit passionate about this area will know how easy it is, without the correct instructions, to make an agent exit its conversation context and touch on topics that should not concern it. A branch that is developing in parallel to prompt engineering is the one that deals with prompt security.

Within this framework, we find [prompt-fuzzer](https://www.prompt.security/fuzzer), today's tool. Prompt fuzzer is an open-source tool written in Python and usable via CLI which, given a prompt, performs a series of different tests based on different attacks studied in this period of AI sector growth, to verify its solidity.

From the interface, you have the possibility to modify your prompt, rerun the various tests, and check which prompts are more vulnerable and which are less.

For example, this is a test I did using a prompt I use to help me correct the articles I write:

![initial-test](https://i.ibb.co/7NpJ70w/start.png)

the result was not optimal, especially because it lacked indications that set limits on the requests made to the model.

I then updated the prompt with more precise indications and the result visibly improved:

![better-result](https://i.ibb.co/1shb2nF/Screenshot-2024-05-18-alle-09-12-23.png)

Within the README in the [Github](https://github.com/prompt-security/ps-fuzz/tree/main) repository, you will also find a general explanation of the various types of attacks described in this table, so you can work better on improving your prompts.

Since AI is becoming more and more present in our projects, both personal and professional, I think having the ability to test how resistant they are to at least the most known attacks is a good idea and can avoid potential unwanted mistakes. 😉

What do you think of this tool? Had you already informed yourself about how to make a prompt secure for your agents?

Let me know your thoughts 😁

For now, I just have to wish you a good week!

Happy Coding 0_1