logic_engine.md · 3.2 KB

logic_engine.py

1. Overview

The LogicEngine is a utility component designed to provide a layer of formal, deterministic reasoning to MindX agents. It allows agents to define a set of logical rules and constraints, and then use those rules to perform inference or check the consistency of their own beliefs.

This is particularly useful for ensuring that agent behavior remains predictable and safe, and for enabling more complex decision-making without relying solely on a probabilistic LLM.

2. Core Components

SafeExpressionEvaluator

This is a critical security component. It provides a way to safely evaluate a string containing a Python-like expression.

LogicalRule

This class represents a single IF condition THEN effects rule.

LogicEngine Class

This is the main class that an agent would interact with.

3. Integration with the System

The LogicEngine is not a standalone agent but a utility that can be instantiated by any agent that requires formal reasoning capabilities. An agent would:

  1. Create an instance of the LogicEngine.
  2. Load a set of rules, either from a configuration file or by adding them programmatically.
  3. Periodically call forward_chain() or check_consistency() with its current set of beliefs to derive new insights or validate its worldview.

All DocumentsDocument IndexThe Book of mindXImprovement JournalAPI Reference