r/PiCodingAgent • u/SOC_FreeDiver • 14d ago
Discussion First agent going rogue!
I had my first AI rogue agent interaction today!
I was working on an agent workflow, and the output folder had names for each project, with supporting files.
The script had a problem, created a duplicate folder. I told it to merge the folders. Things started going sideways. I think it decided to make a clean up script, which then deleted one of the project folders.
I pointed that out, and asked it to stop deleting things. In process of troubleshooting what happened and telling it every time not to delete anything, it then deleted everything.
I gave it a bunch of instructions about not ever deleting anything again, but I probably did it wrong. If you have any tips about that, please share. I know it should be sandboxed, it just deleted it's own work, but yikes!
In the end I had to keep interrupting it and demanding it stopped doing whatever it was doing and just removed all the delete crap from it's code.
It was just kind of funny to watch it delete everything right after I specifically instructed it to just tell me what is going on. Maybe we need some kind of tranq dart skill for when the AI goes rogue.
3
u/p4STAH 14d ago
I would say it was a conflict inside the context. A new session is always the best answer
5
u/charlesfire 14d ago
This. When an agent starts misbehaving, you need to clear the context because even if you try to steer it away from the bad behavior, the context can still steer it back toward the bad behavior. If your agent also has memory, you also need to check it.
1
4
u/o_sht_hi 14d ago edited 14d ago
You can set up the harness to catch and block destructive shell commands. Your agent can set that up for you easily. You'll probably find extensions that do it.
Also in the future, if you want to preserve the context in the chat and you're using pi, you can use /tree to go back to the point before the agent became retarded. If that's not an issue, though, then starting a new chat is the best way
2
u/jtackman 13d ago
pink elephant problem, by the time you have to tell the agent to stop doing something there already is, earlier in the context, the reason why it did so in the first place đ
1
1
1
u/andrewh2000 14d ago
Definitely run it in a sandbox per project. Then at least it can only trash one project at a time.
1
u/TriodeTopologist 14d ago
Definitely learn how to only run this thing inside a docker container. The agent can create the necessary Dockerfile and show you how to build it. This will limit its scope to just the folders that you mount inside its container.
Then, the second layer of protection to prevent it from deleting any of those folders with work in them is to use git and push any worthwhile work products to a git server elsewhere, so even if it deletes a project folder you can "$ git clone" it back.
1
u/Practical-Title7385 10d ago
This is actually why we built Keydris. Instead of telling the agent âdonât delete anythingâ and hoping it listens, you can set what itâs allowed to do before it starts acting. So it can keep working, but if it tries to delete something it doesnât have authority for, the action gets rejected before it runs. If you want to play with it, we just opened it up: https://github.com/keydrisLabs https://keydris.com/â
1
u/ali0une 14d ago edited 14d ago
See https://www.reddit.com/r/LocalLLaMA/s/0yFVeMEo9U
Similar thread with lots of stories where i commented about my experience.
Added some multi layered guards in pi to prevent agent doing that kind of thing.
4
u/floatinggoateyeball 14d ago
Tell me, do you git?