Run Lispex in Your Application

An application calls a Lispex rule in one of three ways. It runs the rule on JSON input with lispex rule run, calls an evaluator with set limits through lispex embed, or uses the application API that Topaz supplies. The pages in this part follow those paths, then cover the MCP server, images, and bytecode.

To try a rule first, open the Playground or run a file as shown in First Program. Install Native or npm from Downloads. File execution uses the Lispex Interpreter by default.

Choose how your application calls a rule

PathWhat the application supplies and gets backGuide
JSON inputThe application supplies the source, a JSON input, and resource limits to lispex rule run. The command writes the result and a readable summary into a new directoryRun a Decision Rule with JSON Input
Evaluator with set limitsThe application prepares the rule and a binary input for lispex embed, evaluates the rule, and inspects the outcome fileRun a Rule Within Set Limits
Topaz applicationTopaz supplies the application API and defines its package and deployment requirementsCall Lispex Rules in the Topaz documentation

In every path, the calling application decides what external action to take from the result.

What your application handles

Your application supplies the input and decides what to do with the answer. Lispex rules have no hidden network calls, clocks, random values, or package imports. The reference implementation uses exact arithmetic where possible and defined evaluation and diagnostic rules.

To compare runs, keep the source bytes, input bytes, executor, and resource profile the same. A resource profile specifies the work and memory available to a run. Compare the same result, output, and diagnostic channels, as described in Repeatable Results and Execution Limits.

Ordinary execution runs trusted source directly in the calling process. lispex compare-engines, which compares execution methods, works the same way. The authoring evaluator in lispex mcp serve runs the source of each request in a separate local worker process. To set work and memory limits for a decision rule, use Native lispex embed. It runs inside the calling process and produces a record linking the rule, input, limits, and outcome when execution completes. Follow Run a Rule Within Set Limits for the required files and commands.

Choose a product

TaskStart hereWhere to read the result
Try source in the browserPlaygroundOutput and diagnostics beside the editor
Run a source file in the terminalNative or npm from DownloadsStandard output, diagnostics, and exit status
Run rules from a Node.js programThe lispex command installed by the lispex npm packageThe command's standard output, diagnostics, and exit status

These products use the same Lispex Interpreter for ordinary source evaluation. Products and Supported Platforms lists their additional features. For SICP lessons, use the separate SICP Study Guide.

Set a resource profile

A resource profile specifies execution limits. Choose the evaluator according to the language features your rule needs.

Command familyLanguage profile
lispex embedDecision language profile
lispex embed fullComplete current language profile, including 205 built-in procedure entries

These are separate evaluators with their own binary interfaces and result formats. Both use WASM components with no imports and create a fresh instance for each request. They account for preparation and evaluation separately and produce a portable core record binding one execution. See Reference for Evaluators with Execution Limits for the interfaces and limits.

Connect tools, images, and bytecode

TaskGuide
Connect the local MCP server to an application that supports MCPConnect the MCP Server
Send rule source inside an image and restore it on the other sideCreate and Restore Lispex Images
Save and execute compiled instructionsCompile a Rule to Bytecode

Compare implementations

To investigate differences in results, output, or diagnostics, read Lispex Interpreter and Lispex VM. That path explains the required products and comparison reports.