# Computational Accountability in MAS Organizations with ADOPT
## 5 Case Study: Accountability in the JaCaMo Framework
### Building-a-House Revisited
```  
Listing 3: Excerpt of the Jason plans needed by an agent playing a role in an organization to be compliant with the goal-agreement phase of ADOPT. ```
1//noprovisionneeded
2+pendingGoal(Ag,Goal)
3:my_name(Ag)&
4 acceptableGoal(Goal)&
5 notprovision(Goal,Prov)
6<-proposeProvision(Goal,true_prov). 7
8//refusegoal
9+pendingGoal(Ag,Goal)
10:my_name(Ag)&
11 notacceptableGoal(Goal)
12<-refuseGoal(Goal). 13
14//proposeprovision
15+pendingGoal(Ag,Goal)
16:my_name(Ag)&
17<-proposeProvision(Goal,Prov). 18
19//agreegoal,provisionaccepted
20+requestedGoal(Ag,Goal)
21:my_name(Ag)&
22 acceptedProposition(Ag,Goal,_)
23<-agreeGoal(Goal). 24
25//provisionconfirmed,mustsatisfyggoal
26+holdingProvision(Goal,Prov)
27:my_name(Ag)&
28 agreedGoal(Ag,Goal)&
29 acceptedProvision(Ag,Goal,Prov)
30<-!Goal[scheme(Scheme)];
31 goalAchieved(Goal)[artifact_id(ArtId)];
32 informGoal(Goal). ```  
Listing 4, in turn, shows an excerpt of the plans needed by [PERSON], as organization owner, to be compliant with the second phase of the ADOPT protocol. First of all, the plan at line 1 allows it to open a call for the achievement of a given goal (line 3) when the corresponding obligation is issued by the organizational infrastructure. The plans at lines 5 and 10, in particular, allow it to accept or reject provisions for goals asked by the role players (lines 7 and 12) depending on whether they seem acceptable or not (lines 6 and 11). If a provision is accepted, then the goal is requested to the agent, too (8). The plans at lines 14 and 19, finally, allow the organization's owners to inform that a given provision which has been agreed by some agent for a goal is holding. To this end, the provision must be present in the agent's belief base (i.e., the agent must believe that the proposition representing the provision is true). Going back to the _companyA_ agent, playing the _plumber_ role, should an _air_conditioning_installed_ (_aci_ for short) goal be requested via _call_for_proposal(achieve(aci))_, the agent would have the legitimate possibility to refuse the proposal or to conditionally accept by specifying a provision. It could therefore ask that the walls be built in order to successfully install the air conditioning by adding _provision(aci, walls_built)_. The plan in line 15 in Listing 3 would be consequently triggered. As a result of executing proposeProvision, the following commitment would be created: \(\mathsf{C_{1}}=C(companyA,Giacomo,accept\_proposal(aci,walls\_built)\wedge request (achieve(aci,walls\_built)),agree(achieve(aci,walls\_built)))\). Giacomo in turn has the freedom to either accept or reject _companyA_'s proposal. Since in the scheme specification walls are built beforehand, Giacomo will reasonably accept the provision by executing the acceptProvision operation in line 7 of Listing 4, leading to the creation of the commitment \(\mathsf{C_{2}}=\mathsf{C}(Giacomo,companyA,request(achieve(aci,walls\_built)) \wedge agree(achieve(aci,walls\_built)),inform(done(walls\_built)))\). Moreover, it will subsequently execute requestGoal, which in turn detaches \(\mathsf{C_{1}}\) and partially satisfies the antecedent in \(\mathsf{C_{2}}\). ```
1+obligation(Ag,_,What,_)[artifact_id(ArtId)]
2:(satisfied(Scheme,Goal)=What|done(Scheme,Goal,Ag)=What)
3<-callForGoal(Ag,Goal). 4
5+pendingProvision(Agent,Goal,Provision)
6:acceptableProvision(Goal,Provision)
7<-acceptProvision(Agent,Goal,Provision);
8 requestGoal(Agent,Goal). 9
10+pendingProvision(Agent,Goal,Provision)
11:notacceptableProvision(Goal,Provision)
12<-rejectProvision(Agent,Goal,Provision). 13
14+agreedGoal(Ag,Goal)
15:acceptedProvision(Ag,Goal,Prov)&
16 Prov
17<-informProvision(Goal,Prov). 18
19+Prov
20:acceptedProvision(Ag,Goal,Prov)&
21 notachievedGoal(Goal)
22<-informProvision(Goal,Prov). ```  
**Listing 4**. Jason plans needed by an organization's owner agent to be compliant with the second phase of the accountability protocol. At this point, _companyA_ should agree to achieve the _aci_ goal to satisfy \(\mathsf{C_{1}}\), given _walls_built_.