{"id":17796386,"url":"https://github.com/d-plaindoux/magnet-js","last_synced_at":"2026-03-03T14:51:30.711Z","repository":{"id":48000840,"uuid":"75158702","full_name":"d-plaindoux/magnet","owner":"d-plaindoux","description":"Javascript Multi-Agent framework","archived":false,"fork":false,"pushed_at":"2023-01-12T10:04:56.000Z","size":453,"stargazers_count":3,"open_issues_count":10,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T16:23:46.382Z","etag":null,"topics":["agent","asynchronous","coordinator","message-passing","promise"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/d-plaindoux.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}},"created_at":"2016-11-30T06:35:56.000Z","updated_at":"2020-11-19T10:00:05.000Z","dependencies_parsed_at":"2023-02-09T11:15:32.145Z","dependency_job_id":null,"html_url":"https://github.com/d-plaindoux/magnet","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/d-plaindoux%2Fmagnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-plaindoux%2Fmagnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-plaindoux%2Fmagnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/d-plaindoux%2Fmagnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/d-plaindoux","download_url":"https://codeload.github.com/d-plaindoux/magnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247665686,"owners_count":20975782,"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":["agent","asynchronous","coordinator","message-passing","promise"],"created_at":"2024-10-27T11:45:17.454Z","updated_at":"2026-01-20T13:01:47.700Z","avatar_url":"https://github.com/d-plaindoux.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Magnet\n\n[![Build Status](https://travis-ci.org/d-plaindoux/magnet.svg?branch=master)](https://travis-ci.org/d-plaindoux/magnet)\n[![Coverage Status](https://coveralls.io/repos/github/d-plaindoux/magnet/badge.svg?branch=master)](https://coveralls.io/github/d-plaindoux/magnet?branch=master)\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\n## Introduction\n\nMagnet is a simple library dedicated to asynchronous and distributed execution\nbased on agent management thanks to a coordinator component.\n\n### Hello World!\n\nAn agent has the capability to communicate with a model. Such model can\nbe a simple class or a function. Finally a model can interact with other\nagent or can simply create or manage existing agents.\n\n#### The Functional style\n\n```javascript\nfunction hello(request, response) {\n    response.success(\"Hello \" + request + \"!\");\n}\n```\n\nThen such function can be simply managed by an agent and hosted by a given\ncoordinator.\n\n```javascript\nconst aCoordinator = coordinator();\n\naCoordinator.agent(\"hello\").bind(hello);\n```\n\n#### The Object-Oriented style\n\n```javascript\nclass Hello {\n    accept(request, response) {\n        response.success(\"Hello \" + request + \"!\");\n    }\n}\n```\n\n```javascript\nconst aCoordinator = coordinator();\n\naCoordinator.agent(\"hello\").bind(new Hello());\n```\n\n#### Asking `World` job to the `hello` agent\n\n```javascript\n// ask returns a Promise\naCoordinator.ask(\"hello\", \"World\").then(console.log);\n```\n\nUsing explicit response handler bound to the promise:\n```javascript\nconst aResponse = response(console.log);\n\naResponse.bind(aCoordinator.ask(\"hello\", \"World\"));\n```\n\n## Coordinator physiology\n\n### Agent creation and life cycle\n\nCreate/Retrieve an agent using its name.\n\n```\ncoordinator.agent :: string -\u003e Agent\n```\n\nDestroy an agent using its name.\n\n```\ncoordinator.dispose :: string -\u003e unit\n```\n\n### Agent interaction\n\nAsk an identified agent. This returns a promise.\n\n```\ncoordinator.ask :: (string,'a) -\u003e Promise 'b'\n```\n\n## License\n\nCopyright (C)2017 D. Plaindoux.\n\nThis program is  free software; you can redistribute  it and/or modify\nit  under the  terms  of  the GNU  Lesser  General  Public License  as\npublished by  the Free Software  Foundation; either version 2,  or (at\nyour option) any later version.\n\nThis program  is distributed in the  hope that it will  be useful, but\nWITHOUT   ANY  WARRANTY;   without  even   the  implied   warranty  of\nMERCHANTABILITY  or FITNESS  FOR  A PARTICULAR  PURPOSE.  See the  GNU\nLesser General Public License for more details.\n\nYou  should have  received a  copy of  the GNU  Lesser General  Public\nLicense along with  this program; see the file COPYING.  If not, write\nto the  Free Software Foundation,  675 Mass Ave, Cambridge,  MA 02139,\nUSA.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-plaindoux%2Fmagnet-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fd-plaindoux%2Fmagnet-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fd-plaindoux%2Fmagnet-js/lists"}