Allow agents to have permissions, user or a role
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3556389. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>There are two problems right now in terms of agents and roles/permissions:</p> <p>1. If we use only the end-users permissions, the agent itself will have the same permissions, and wide generic tools that are not constrained, might be used as attack vectors via prompt injection.<br> 2. When autonomous agents runs in cron, ECA or something else, they run as an anonymous user, meaning that they might not be able to solve what they want to solve, because they don't have enough permissions.</p> <p>We should solve this by assigning either an user, a role or a set of permissions to the agent. That means that:</p> <p>1. If you use it via an UX interface like the chatbot, the LEAST PERMISSIVE COMBINATION of your combined permissions will be used by the agent. This means that if your agent can generate article, both the end-user and the agent need to have that permission. If any of the two is missing, it will not be allowed.<br> 2. If you use it via some autonomous way of running, unless otherwise specificied (ECA can upcast for instance, then see #1 above), the agents permissions is the rule.</p> <h3>Discuss and decide</h3> <p>This needs to be discussed and decided before starting work on this issue. Should the mode be assign a user, assign a/many role(s) or assign a list of permissions. Or something else?</p> <p>Some initial thoughts of cons (not much thought put into it):</p> <p><strong>User:</strong></p> <ul> <li>For recipes or modules, you have to provide a user content, which causes too many users since each recipe or module will generate a unique one.</li> <li>User's can be overtaken by mistake, so it produces a security risk. It also needs to have a password asfaik that could be guessed.</li> <li>We do not want to anthropomorphisize the agents more then necessary.</li> </ul> <p><strong>Role(s):</strong></p> <ul> <li>For recipes or modules, you have to provide a role config, which causes too many role since each recipe or module will generate a unique one.</li> </ul> <p><strong>Permissions:</strong></p> <ul> <li>We need to replicate a very complex UI/UX.</li> </ul> <p>Also we need to check if we need to have a flag on the agent runner that this is an autonomous agent - since its otherwise hard to codewise understand the difference between an anonymous user using the chatbot and an ECA run for instance.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <ul> <li>Take a decision above.</li> <li>Add to the agent form a good UX for the decision.</li> <li>When running, merge the two permissions and create a temporary user for the run with the lowest combinations of permissions of the two.</li> </ul> > Related issue: [Issue #3573899](https://www.drupal.org/node/3573899) > Related issue: [Issue #3552038](https://www.drupal.org/node/3552038)
issue