# Computational Accountability in MAS Organizations with ADOPT
## 5 Case Study: Accountability in the JaCaMo Framework
### Accountability Issues and Their Reasons  
In order to explain the lack of accountability of [PERSON], let us now consider a scenario based on an excerpt of the _building-a-house_ example presented in [11]:  
**Example 2**. : _An agent, called [PERSON], wants to build a house on a plot. In order to achieve the goal he will have to hire some specialized companies, and then ensure that the contractors coordinate and execute in the right order the various subgoals. Some tasks depend on other tasks while some other tasks can be performed in parallel. This temporal ordering is specified in the functional specification of the scheme describing the process._  
As soon as the building phase starts, [PERSON] creates a GroupBoard artifact, called here bb_group (for sake of discussion, the example is slightly revised with respect to the original version, presented in [11]. This includes a change in the artifacts' names), following the organization specification. Roles are gathered in a group that will, then, be responsible for the house construction. After that, he adopts his role and asks the hired agents to adopt theirs. Roles are adopted by executing an operation that is provided by the GroupBoard artifact. Finally, a SchemeBoard artifact, called bh_scheme, is created. When all agents have adopted their roles (i.e., when the group is well-formed), this is added to the schemes the group is responsible for. After this step, the involved agents could be asked to commit to some \"missions\"--in JaCaMo, the term \"commit\" does not refer to social commitments but it is used in a general sense. This is done by relying on obligations that are issued by the organization, according to the normative specification. Figure 3 shows the general interaction pattern which is used in JaCaMo for role adoption, mission distribution and goal assignment, as it would be instantiated for a companyA agent, a plumber role and an install_plumbing mission (which in turn contains a plumbing_installed goal). Agent companyA is asked to commit to install_plumbing with an obligation of the form obligation(companyA, nB, committed(companyA, install_plumbing,...),...), where n8 is the norm that binds the plumber role with the install_plumbing mission in the normative specification. This does not yet mean the agent has to pursue the goal; this other obligation, however, may now be issued by the organization. Indeed, the main purpose of the SchemeBoard artifact, bh_scheme, is to keep track of which goals are ready to be pursued and create obligations for the agents accordingly. For instance, when the plumbing_installed goal will be ready to be pursued, companyA will receive a new an obligation obligation(companyA,..., achieved(..., plumbing_installed, companyA),...), and so forth with other organizational goals as soon as they become ready. Such obligations are observed by the agents and the corresponding internal goals are automatically created. Listing 1 shows an excerpt of the companyA agent. The above-mentioned obligation, through the plan at line 15, creates the (internal) goal that is then pursued by following the plan at line 21. After that, the organizational goal is set as achieved, too (line 19), using the goalAchieved operation provided by the SchemeBoard artifact. ```
1 task_roles(\"Plumbing\", [plumber]). 2
3+!contract(Task,GroupName)
4:task_roles(Task,Roles)
5<-lookupArtifact(GroupName,GroupId);
6 for(.member(Role, Roles)){
7 adoptRole(Role)[artifact_id(GroupId)];
8 focus(GroupId)
9}. 10
11+obligation(Ag,Norm,committed(Ag,Mission,Scheme),Deadline)
12:.my_name(Ag)
13<-commitMission(Mission)[artifact_name(Scheme)]. 14
15+obligation(Ag,Norm,What,Deadline)[artifact_id(ArtId)]
16:.my_name(Ag)&
17(satisfied(Scheme,Goal)=What|done(Scheme,Goal,Ag)=What)
18<-!Goal[scheme(Scheme)];
19 goalAchieved(Goal)[artifact_id(ArtId)]. 20
21+!plumbing_installed
22<-installPlumbing. ```  
**Listing 1**. Excerpt of the Jason code of the companyA agent.