Skip to main content

Python SDK for NocturnusAI — a logic-based inference engine and knowledge database

Project description

NocturnusAI Python SDK

Python SDK for NocturnusAI — a logic-based inference engine and knowledge database for agentic AI systems.

Install

pip install nocturnusai

With LangChain integration:

pip install "nocturnusai[langchain]"

Quick start

import asyncio
from nocturnusai import NocturnusAIClient

async def main():
    async with NocturnusAIClient("http://localhost:9300") as client:
        # Store facts
        await client.tell("likes(alice, bob)")
        await client.tell("likes(bob, carol)")

        # Define rules
        await client.teach("friends(?x, ?y) :- likes(?x, ?y), likes(?y, ?x)")

        # Run inference
        results = await client.ask("friends(?x, ?y)")
        print(results)  # ['friends(alice, bob)', 'friends(bob, alice)']

asyncio.run(main())

Sync usage:

from nocturnusai import SyncNocturnusAIClient

with SyncNocturnusAIClient("http://localhost:9300") as client:
    client.tell("likes(alice, bob)")
    print(client.ask("likes(?x, bob)"))

LangChain integration

from langchain_openai import ChatOpenAI
from langchain.agents import create_react_agent, AgentExecutor
from nocturnusai.langchain import get_nocturnusai_tools

tools = get_nocturnusai_tools("http://localhost:9300")
llm = ChatOpenAI(model="gpt-4o")
agent = AgentExecutor(agent=create_react_agent(llm, tools, prompt), tools=tools)

MCP (Model Context Protocol)

from nocturnusai import NocturnusAIMCPClient

async with NocturnusAIMCPClient("http://localhost:9300") as mcp:
    await mcp.initialize()
    tools = await mcp.list_tools()
    result = await mcp.call_tool("tell", {"statement": "likes(alice, bob)"})

Or configure via mcp-config.json for Claude Desktop, Cursor, Windsurf, and VS Code — see mcp-configs/ in the main repo.

Starting NocturnusAI

# Docker (recommended)
docker run -p 9300:9300 ghcr.io/auctalis/nocturnusai:latest

# Or one-line install
curl -fsSL https://raw.githubusercontent.com/Auctalis/nocturnusai/main/install.sh | bash

Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nocturnusai-0.2.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nocturnusai-0.2.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file nocturnusai-0.2.0.tar.gz.

File metadata

  • Download URL: nocturnusai-0.2.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nocturnusai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5a29bda718725edb4011b79c7d543afcd71211aea479fae4f68ddf3b72505cb2
MD5 1ddd77a764b30ab39df1cb5bfe8ff2bb
BLAKE2b-256 c8ff8d6faf079f70c479847b3cefad378b614228c70c97176177dd2ee17402fc

See more details on using hashes here.

File details

Details for the file nocturnusai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: nocturnusai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nocturnusai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fd3b110940e5291a78a469c60345e53f224a13dc8f1baa19352e4890ff495be
MD5 e45c0d616ebf081741711c0d1ce102f7
BLAKE2b-256 ccf4c79384d0514696bdac974093e752c898eb67575676dc45cf06de3433a5ed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page