# Computational Accountability in MAS Organizations with ADOPT
## 5 Case Study: Accountability in the JaCaMo Framework
### Achieving Accountability  
We now show how we implemented the ADOPT accountability protocol in JaCaMo. A new kind of artifact, called _AccountabilityBoard_ artifact, was added to the organizational infrastructure to preserve modularity. (The source code of the AccountabilityBoard artifact can be found here: [[http://di.unito.it/accountabilityboard](http://di.unito.it/accountabilityboard)]([http://di.unito.it/accountabilityboard](http://di.unito.it/accountabilityboard)).) In other words, this addition did not affect the implementation of the other organizational artifacts that were previously in JaCaMo. The new artifact supports both phases of ADOPT: the role-adoption phase and the goal-agreement phase. The artifact also provides some observable properties, informing the agents that focus on it about the overall state of the interaction. These observable properties represent the events occurring during the interaction, and allow encoding of the created commitments. More precisely, the artifact keeps track, in the first phase, of which calls for roles are pending, of the agents' replies, of which proposals have been accepted (and which have not), of which agents have successfully completed the role adoption, and which have failed. Later on, in the goal-agreement phase, the observable properties encode which provisions were accepted and which were not, which goals were agreed upon by which agents (and with what kinds of provisions), which ones were refused, and which provisions were confirmed to be holding. All such observable properties are created by executing the above described operations on the accountability artifact. In case of inspection, the observable properties help to identify the accountable parties. Concerning the role-adoption phase, the artifact provides an organization with the operations to call for role players, and to accept or reject the agents' proposals. Agents, on the other hand,are provided with the operations to answer calls (either by refusing, or by proposing themselves), to declare the acquisition of organizational powers and to declare a failure in the role-adoption process. With respect to the power awareness declaration, we assume here that an agent acquires the powers to operate on a given scheme when the scheme is assigned to the group to which the agent belongs, and when the agent commits to the missions associated with its role in the scheme itself. To stipulate this awareness, the agent declares it has access both to the group and to the scheme artifacts, as player of the given role, which together define the scope of the agents' actions in the organizational context. By doing so, the agent ensures that it is conscious that it could be requested to achieve organizational goals defined in the given scheme as a role player in the given group (and it will have the possibility to refuse them or agree to their achievement). Should a new scheme be added to a given group, agents inside it should renegotiate the terms of role adoption (by executing again the first phase of the protocol) in order to acquire the organizational powers needed to act on the new scheme, too. The _AccountabilityBoard_ artifact operations that allow all these things are:  
* callForRole(String addressee, String role): implements ADOPT's _call_for_proposal(adopt_role(Ag, R))_. It allows the organization's owner to open a call for a role, addressed to a given agent. An observable property pendingRole(addressee, role) is defined;
* refuseRole(String role): implements _propose(adopt_role(Ag,R))_. It allows agents to answer to a call for role, refusing to adopt it. Its execution creates an observable property refusedRole(agent, role);
* proposeForRole(String role): implements _propose(adopt_role(Ag,R))_, and allows agents to propose themselves as role players. It creates an observable property proposedForRole(agent, role);
* rejectProposalForRole(String proposer, String role): implements _propose(adopt_role(Ag, R))_, and allows an organization's owner to reject a proposer agent's proposal.