# Programming Agents by Their Social Relationships: A Commitment-Based Approach
## 5 2 COMM: An Infrastructure for Programming Social Relationships  
We have claimed that an agent-based framework should provide an explicit representation of the social relationships created between the agents as first-class entities and that these relationships should be used directly for programming the agent behaviors. 2 COMM [8] is a middleware that fills such a gap by reifying social commitments as artifacts available in the environment. Currently, 2 COMM supports social relationship-based agent programming for JADE and JaCaMo agents through two dedicated connectors. JADE [2] is an agent platform that supplies standard agent services, i.e., message passing, distributed containers, naming and yellow pages services, and agent mobility. JaCaMo [5], in turn, is a platform integrating three other frameworks: Jason [33] for programming agents, CArtAgO [34] for programming artifact-based environments, and Moise [35] as a support to the realization of multiagent organizations. The loose coupling between the agent-programming dimension and the interaction component makes the development of new connectors for other agent platforms straightforward.  
2 COMM relies on CArtAgO for the implementation of a (distributed) social state. Specifically, CArtAgO provides a way to define and organize _workspaces_, which are logical groups of artifacts, which can be joined by agents at runtime. The CArtAgO API allows programming artifacts, regardless of the agent programming language or the agent framework used. This is possible by means of the _agent body_ metaphor: CArtAgO provides a native agent entity, which acts as a \"proxy\" in the artifacts workspace. An agent developed in a given agent programming platform is the \"mind\" that uses the CArtAgO agent entity as a \"body\" to interact with artifacts. An agent, in particular, acts upon an artifact by executing public _operations_, which can be equipped with _guards_; i.e., conditions that must hold for operations in order to produce their effects. An artifact provides also some _observable properties_ that can be perceived by the agents _focusing_ on it and encode the artifact's current state. Observable properties can change over time as a result of the operations occurring inside the artifact.  
By means of CArtAgO, 2 COMM reifies social commitments as a special class of _commitment artifacts_. Each commitment artifact provides two roles that agents can enact, corresponding to the debtor and to the creditor of the commitment maintained by the artifact. Roles can be seen as proxies that allow agents to operate on the corresponding commitment artifact. For instance, by adopting the debtor role, an agent will be able to perform the artifact operations to create the corresponding commitment or to cancel it. Roles are linked to agents of the specific platform via dedicated connector classes. 2 COMMprovides the classes for representing commitments, maintained into commitment artifacts, as well as roles. Moreover, the infrastructure automatically handles the commitment progressions according to the events occurring in the environment. In particular, events that are relevant for the progression of commitments are encoded as _social facts_. 2 COMM maintains a trace of all the social facts asserted in a given interaction and updates the involved commitments accordingly.  
Agent programming with 2 COMM amounts, at its core, to realizing a classical \"sense-plan-act cycle\", whose phases can be renamed \"observe the workspace\", \"activate behaviors according to the entice/cooperate schemas\", and \"schedule behavior execution\". In the following, we will sketch how these three steps are practically carried out in the two agent platforms, JADE and JaCaMo.