Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Python API

The public FrameX-Core Python package contains the client for the reasoning engine, an external-tool host, model-provider integration, dialogue flows and a coverage interviewer. It requires Python 3.10 or newer and has no third-party runtime dependencies. The Rust engine is installed separately.

Where the FrameX Syntax describes what you write, the Python API describes how a program drives the engine: loading programs, asking queries and revising state.

from framex import Client

with Client() as client:
    client.load("world open.\n socrates:Human.\n ?X:Mortal <- ?X:Human.")
    result = client.query("?- socrates:Mortal.")
    print(result)  # {'status': 'true'}

In the following chapters, the Python API will be explained:

The Python API Exercise teaches the persistent client. The hybrid section explains how to choose a coupling and keep acceptance decisions in rules.