{"id":16906167,"url":"https://github.com/timkam/empathic-agents-js","last_synced_at":"2026-05-15T23:40:36.688Z","repository":{"id":83115317,"uuid":"151068403","full_name":"TimKam/empathic-agents-js","owner":"TimKam","description":"Implementing empathic agents in JavaScript","archived":false,"fork":false,"pushed_at":"2018-11-03T19:48:09.000Z","size":79,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-25T15:24:53.302Z","etag":null,"topics":["multi-agent-systems","nodejs","reasoning"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimKam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-01T10:02:17.000Z","updated_at":"2018-11-03T19:48:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"9662890d-5418-4e7b-8331-43291e3df343","html_url":"https://github.com/TimKam/empathic-agents-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKam%2Fempathic-agents-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKam%2Fempathic-agents-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKam%2Fempathic-agents-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimKam%2Fempathic-agents-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimKam","download_url":"https://codeload.github.com/TimKam/empathic-agents-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244648036,"owners_count":20487192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["multi-agent-systems","nodejs","reasoning"],"created_at":"2024-10-13T18:41:32.332Z","updated_at":"2026-05-15T23:40:31.658Z","avatar_url":"https://github.com/TimKam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Empathic agents: running example in JavaScript (Node.js)\n[![Build Status](https://travis-ci.org/TimKam/empathic-agents-js.svg?branch=master)](https://travis-ci.org/TimKam/empathic-agents-js)\n\n**Author**: [Timotheus Kampik](https://github.com/TimKam)\n\nThis repository contains an example implementation of *empathic agents*--agents that use to make trade-offs between their own utility and the utility of other agents in their environment when deciding which actions they should execute--implemented in JavaScript (for Node.js).\n\n## Empathic agents\nThis repository is meant as supplementary material to a book chapter, in which we provide a detailed explanation of the empathic agent concept.\nA colloquial description of some of the underlying concepts can be found in [this README](https://github.com/TimKam/empathic-jason/blob/master/README.md#empathic-agents).\n \n## Architecture\nThe example is implemented in JavaScript for Node.js, as a web-socket based client-server application.\nThe agents are clients, while the server models the environment and manages agent communications:\n\n*   **Socket server:**\n\n    The socket server consists of a *generic server module* and a *environment specification* that describes a particular scenario.\n\n    *   **Generic server module:**\n\n        The generic server module provides the communication backbone for agent interaction, and also manages the share value system.\n\n\n    *   **Environment specification:**\n\n        The environment specification describes the world the agents \"live\" in, i.e. the shared value system the agents rely on.\n\n*   **Agents**\n    \n    Each agent depends on the *generic agent module* and has its own *agent specification*.\n\n    *   **Generic agent module:**\n\n        The generic agent module provides the empathic agent algorithms to the agents.\n\n    *   **Agent specification:**\n\n        An agent specification defines an agent's utility function and registers the agents with the server.\n\n\nCurrently, the application is limited to two agents.\nFor this basic demonstrations, both socket server and clients run on the same machine.\nThe default scenario this project implements is a one-off vehicle coordination scenario (see below).\nIt is possible to adjust the agent and environment specification to run more advanced custom scenarios;\nhowever, this scientific prototype takes some short cuts that make it infeasible for production use.\n\n## Requirements\nThe examples are implemented in JavaScript and require [Node.js](https://nodejs.org/), version 10.11.0 or later, as well as [npm](https://www.npmjs.com/) or [yarn](https://yarnpkg.com).\nThe instructions below assume Node.js and npm (or yarn, respectively) are installed.\n\n## Installation\nClone this repository with ``git@github.com:TimKam/empathic-agents-js.git``.\nThen, install program and its dependencies with ``npm install`` or ``yarn``.\nYou find an overview of the required npm packages that will be automatically installed in the [package.json](./package.json) file.\n\n## Running the example\nIn this project, we provide the *vehicle* scenario of the corresponding research paper as a running example.\nTo run the example proceed as follows:\n\n*   Navigate to the project's root directory and open three terminal windows.\n\n*   In your first window, start the environment server by executing ``node ./src/server.js``.\n\n*   In your second and and third window, start two agent by running ``node src/agent.js \u003cscenarioType\u003e \u003cagentId\u003e \u003cagentType\u003e``, with:\n\n    *   ``\u003cscenarioType\u003e``: the scenario to be executed (either ``vehicles``, or ``music``);\n\n    *   ``\u003cagentId\u003e``: the ID of the agent (either ``0`` or ``1``);\n\n    *   ``\u003cagentType\u003e``: the type of the agent (either ``naive``, ``lazy``, or ``full``).\n\n    For example, you could run ``node src/agent.js music 1 full`` in one window and ``node src/agent.js music 0 full`` in the other.\n\nNote that you can adjust the example specification to run other 2-agent scenarios.\n\n## Testing\nThe project contains a set of [Jasime](https://jasmine.github.io/2.0/node.html) tests.\nTo execute the tests, run ``npm test``.\n\n## Generating JSDoc\nThe code of this project is documented with [JSDoc](http://usejsdoc.org/).\nTo generate the documentation, run ``npm run doc``.\nYou will find the generated documentation in the ``out`` directory.\n\n## Acknowledgements\nThis work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation.\n\n\u003c!--## References\n*   [1] T. Kampik, J. C. Nieves, and H. Lindgren, “Towards empathic autonomous agents,” in 6th International Workshop on Engineering Multi-Agent Systems (EMAS 2018), Stockholm, 2018.--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkam%2Fempathic-agents-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimkam%2Fempathic-agents-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimkam%2Fempathic-agents-js/lists"}