Powering the Web with Logic-based AI

Logic Production System (LPS) is a logic-based production system language that unifies both forward and backward inference methods into a single framework, embedding an agent's goals as reactive rules and its beliefs as logic programs.


lps.js is the LPS interpreter implemented in JS. Want to see how lps.js works?

Go to Sandbox

Installing via npm

Install lps.js for your server-side JS app via Node.js package manager (npm) by running the command:

$ npm install lps --save

Then in your code, require() lps.js and run a program file "program.lps" like this :

const LPS = require('lps');
LPS.loadFile('program.lps')
  .then((engine) => {
      engine.run();
  });

Alternatively, a LPS program can also be loaded from string:

const LPS = require('lps');
LPS.loadString('...')
  .then((engine) => {
      engine.run();
  });

Running as CLI

Use the CLI Toolset to run LPS programs from the CLI:

$ npm install -g lps-cli

To run a LPS program file "program.lps", run:

$ lps program.lps

  • lps
  • lps-test
  • lps-generate-spec
  • lps-p2p-tracker

For more information and help usage about the CLI Toolset, use the '-v' argument option for each of the available programs.

Using for Frontend

Download the lps.js release bundled for browsers from the Releases page.

Then, use the bundled file through the <script> tag:

<script src="lps.bundle.js"></script>

The LPS API is available through the global variable LPS:

LPS.loadFile('program.lps')
  .then((engine) => {
      engine.run();
  });

Alternatively, a LPS program can also be loaded from string:

LPS.loadString('...')
  .then((engine) => {
      engine.run();
  });

LPS Studio

LPS Studio

LPS Studio is the interactive storytelling tool for visualising LPS programs.

Check out the LPS Studio project at its repository.