Integrations

One import. Context compression for your entire stack.

NocturnusAI plugs into the frameworks you already use. Every integration gives your agent the same core abilities: store facts, run inference, and get compressed context — cutting tokens by 82–90% (measured on Claude Opus 4 and Gemini 2.0 Flash).

Install what you need
pip install nocturnusai                    # core SDK
pip install nocturnusai[langchain]         # + LangChain tools
pip install nocturnusai[crewai]            # + CrewAI tools + Storage backend
pip install nocturnusai[langgraph]         # + LangGraph checkpoint saver
pip install nocturnusai[autogen]           # + AutoGen tool functions + Memory
pip install nocturnusai[openai-agents]     # + OpenAI Agents SDK tools
pip install nocturnusai[all]               # everything

TypeScript: npm install nocturnusai-sdk — zero runtime dependencies, built-in fetch.


The Pattern

Every integration works the same way.

Create a client. Get the tools. Pass them to your agent. Your agent can now store facts, run inference, and get compressed context — all through the framework's native tool system.

Step 1

Create the client

SyncNocturnusAIClient(url)
Step 2

Get the tools

get_nocturnusai_tools(client)
Step 3

Pass to your agent

Agent(tools=tools)

LangChain

Seven tools for any LangChain agent.

Assert facts, teach rules, query with inference, get salience-ranked context, run goal-driven optimization, and extract structured facts from raw text. All as native BaseTool subclasses with Pydantic schemas.

See the 5-minute example →

assert query infer teach context optimize extract
pip install nocturnusai[langchain]
from nocturnusai import SyncNocturnusAIClient
from nocturnusai.langchain import get_nocturnusai_tools
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_openai import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate

client = SyncNocturnusAIClient("http://localhost:9300")
tools = get_nocturnusai_tools(client)  # 7 tools

llm = ChatOpenAI(model="gpt-4o")
prompt = ChatPromptTemplate.from_messages([
    ("system", "Use NocturnusAI for reasoning."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)

result = executor.invoke({
    "input": "Who is the grandparent of charlie?"
})

pip install nocturnusai[crewai]
from nocturnusai import SyncNocturnusAIClient
from nocturnusai.crewai import get_nocturnusai_tools, NocturnusAIStorage
from crewai import Crew, Agent
from crewai.memory import LongTermMemory

client = SyncNocturnusAIClient("http://localhost:9300")
tools = get_nocturnusai_tools(client)
storage = NocturnusAIStorage(client=client)

researcher = Agent(
    role="researcher",
    goal="Gather and reason about facts",
    tools=tools,
)

crew = Crew(
    agents=[researcher],
    tasks=[...],
    memory=True,
    long_term_memory=LongTermMemory(storage=storage),
)

# Crew memory persisted as logical facts — not embeddings
result = crew.kickoff()
CrewAI

Tools + long-term memory backend.

Five BaseTool subclasses for tell/ask/teach/forget/context, plus a Storage backend that persists crew memory as logical facts instead of embeddings. Your crew remembers through reasoning, not similarity search.

See the 5-minute example →

tell ask teach forget context Storage

LangGraph

Checkpoint saver for stateful workflows.

Persist LangGraph state as NocturnusAI facts. Each thread maps to a scope for isolation. The logic engine tracks state changes with truth maintenance — retract old checkpoints automatically when new ones arrive.

Unlike a database checkpoint, NocturnusAI can reason about the saved state — answer queries across threads, detect contradictions, and derive new facts from workflow history.

pip install nocturnusai[langgraph]
from nocturnusai import SyncNocturnusAIClient
from nocturnusai.langgraph import NocturnusAICheckpointSaver
from langgraph.graph import StateGraph

client = SyncNocturnusAIClient("http://localhost:9300")
saver = NocturnusAICheckpointSaver(client=client)

graph = StateGraph(State)
graph.add_node("agent", agent_node)
graph.add_node("tools", tool_node)
graph.add_edge("agent", "tools")
graph.set_entry_point("agent")

# State persisted to NocturnusAI — thread isolation via scopes
app = graph.compile(checkpointer=saver)

config = {"configurable": {"thread_id": "conv-1"}}
result = app.invoke(input_data, config)

pip install nocturnusai[autogen]
from nocturnusai import SyncNocturnusAIClient
from nocturnusai.autogen import get_nocturnusai_tools, NocturnusAIMemory
from autogen_agentchat.agents import AssistantAgent
from autogen_core.tools import FunctionTool

client = SyncNocturnusAIClient("http://localhost:9300")
tools = get_nocturnusai_tools(client)
memory = NocturnusAIMemory(client=client)

agent = AssistantAgent(
    name="reasoner",
    model_client=model_client,
    tools=[FunctionTool(t, name=t.__name__) for t in tools],
    memory=[memory],
)

# Memory persists across conversations via logical facts
await agent.run(task="What do we know about Acme?")
AutoGen

Tool functions + Memory protocol.

Five plain Python functions for tell/ask/teach/forget/context, plus an async Memory protocol implementation. The memory module automatically injects the most salient facts into your agent's context on every turn.

Works with or without autogen-agentchat. The tool functions are framework-agnostic.


Direct SDK Integrations

OpenAI Agents & Anthropic.

No framework required. Native tool definitions for the provider SDKs.

OpenAI Agents SDK

pip install nocturnusai[openai-agents]
from nocturnusai import SyncNocturnusAIClient
from nocturnusai.openai_agents import get_nocturnusai_tools
from agents import Agent

client = SyncNocturnusAIClient("http://localhost:9300")
tools = get_nocturnusai_tools(client)
# 5 tools, auto-decorated with @function_tool

agent = Agent(
    name="reasoner",
    instructions="Use NocturnusAI for memory.",
    tools=tools,
)

See the 5-minute example →

Anthropic SDK

pip install nocturnusai anthropic
from nocturnusai.anthropic_tools import (
    get_nocturnusai_tool_definitions,
    handle_tool_call,
)

tools = get_nocturnusai_tool_definitions()
# 5 JSON schema dicts for the Messages API

response = anthropic_client.messages.create(
    model="claude-sonnet-4-20250514",
    tools=tools,
    messages=[...],
)
# In tool-use loop:
result = handle_tool_call(
    nocturnusai_client, block.name, block.input
)

MCP

16 tools for Claude, Cursor, Windsurf, VS Code.

NocturnusAI speaks the Model Context Protocol natively. Point your IDE or Claude Desktop at the server and your AI assistant gains deterministic reasoning, fact storage, and context compression — no code changes.

See the 5-minute example →

tell ask teach forget context predicates aggregate bulk_assert retract_pattern fork_scope merge_scope +5 more
claude_desktop_config.json
{
  "mcpServers": {
    "nocturnusai": {
      "command": "npx",
      "args": [
        "-y", "mcp-remote",
        "http://localhost:9300/mcp/sse"
      ]
    }
  }
}
.cursor/mcp.json (or VS Code / Windsurf)
{
  "mcpServers": {
    "nocturnusai": {
      "url": "http://localhost:9300/mcp/sse"
    }
  }
}

npm install nocturnusai-sdk
import { NocturnusAIClient } from 'nocturnusai-sdk';

const client = new NocturnusAIClient({
  baseUrl: 'http://localhost:9300',
});

// Store facts and rules
await client.tell('parent', ['alice', 'bob']);
await client.tell('parent', ['bob', 'charlie']);
await client.teach(
  { predicate: 'grandparent', args: ['?x', '?z'] },
  [
    { predicate: 'parent', args: ['?x', '?y'] },
    { predicate: 'parent', args: ['?y', '?z'] },
  ],
);

// Inference — derives grandparent(alice, charlie)
const results = await client.ask('grandparent', ['?who', 'charlie']);

// Context compression
const ctx = await client.context({
  goals: [{ predicate: 'grandparent', args: ['?who', 'charlie'] }],
  maxFacts: 10,
});
// ctx.briefingDelta → only what's relevant
TypeScript · Vercel AI SDK

Full API coverage. Zero dependencies.

46 typed methods covering the full NocturnusAI API. Uses built-in fetch — no runtime dependencies. SSE event subscription for real-time knowledge change notifications. Drop into any Vercel AI SDK route handler to compress context before streamText.

See the 5-minute Vercel AI SDK example →

46 methods typed returns async/await SSE events retry + backoff 0 deps