Explore Architecture β’ Quickstart β’ Core Innovations β’ Live Providers β’ Framework Comparison β’ Roadmap
MindLatticeAI is a research-oriented, adaptive AI orchestration framework designed around a fundamental premise:
Every AI request is an experiment. An autonomous agent must formulate a strategy, compile a resilient execution graph, evaluate its own intermediate reasoning, mutate its prompt genomes, learn from execution telemetry, and store experiential knowledge across multi-layer memory meshes.
This repository is intentionally not a LangChain clone, a CrewAI-style static conversational crew, or a simple LiteLLM router. Its core abstraction is an Execution-History Learning Loop operating over Cognitive Directed Acyclic Graphs (DAGs) with checkpointed node resilience and evolvable prompt genomes.
οΏ½[1;36m[MindLatticeAI Runtime]οΏ½[0m Initializing Request: οΏ½[1;33m"Calculate 21 * 2 and reflect on strategy"οΏ½[0m
οΏ½[1;34mβββ [1. INTENT]οΏ½[0m Task: οΏ½[32mTOOL_AUGMENTED_REASONINGοΏ½[0m | Tools Required: οΏ½[33m['calculator']οΏ½[0m | Risk: οΏ½[32mNORMALοΏ½[0m
οΏ½[1;34mβββ [2. PLANNER]οΏ½[0m Compiled Strategy: οΏ½[35mstrategy_da4539οΏ½[0m | Genome: οΏ½[35mgenome.default.cognitive (gen 0)οΏ½[0m
οΏ½[1;34mβββ [3. POLICY]οΏ½[0m Budget: Max $0.25 | Latency: 15,000ms | οΏ½[1;32mChecks Passed (ALLOWED)οΏ½[0m
οΏ½[1;34mβββ [4. DAG ENGINE]οΏ½[0m Executing Cognitive Graph (7 Nodes):
οΏ½[1;34mβ βββ [RUN]οΏ½[0m tool.calculator ββββΊ οΏ½[1;32mSUCCEEDEDοΏ½[0m (42.0) [1ms]
οΏ½[1;34mβ βββ [RUN]οΏ½[0m model.main ββββΊ οΏ½[1;32mSUCCEEDEDοΏ½[0m (routed: local:heuristic-v1) [2ms]
οΏ½[1;34mβ βββ [RUN]οΏ½[0m reflect.self_check ββββΊ οΏ½[1;32mSUCCEEDEDοΏ½[0m (critique: grounded) [1ms]
οΏ½[1;34mβ βββ [RUN]οΏ½[0m evaluate.score ββββΊ οΏ½[1;32mSUCCEEDEDοΏ½[0m (quality: 0.932, hallucination: 0.05)
οΏ½[1;34mβ βββ [PARALLEL]οΏ½[0m memory.write & learn.update ββββΊ οΏ½[1;32mSUCCEEDEDοΏ½[0m [checkpointed]
οΏ½[1;34mβ βββ [FINALIZE]οΏ½[0m final.response ββββΊ οΏ½[1;32mREADYοΏ½[0m
οΏ½[1;34mβββ [5. LEARNER]οΏ½[0m Feedback Prior Updated: Prior 0.85 βββΊ οΏ½[1;32m0.932οΏ½[0m | Genome Fitness: οΏ½[1;32m+0.082οΏ½[0m
Traditional agent frameworks rely on static, brittle chains or fixed multi-agent chat loops. MindLatticeAI pioneers an adaptive, closed-loop execution paradigm:
| Feature / Dimension | LangChain / LlamaIndex | CrewAI / AutoGen | LiteLLM | π§ MindLatticeAI |
|---|---|---|---|---|
| Execution Topology | Static Chains / Agents | Conversational Chat Loops | Flat Provider Routing | Dynamic Cognitive DAGs with node checkpoints & retries |
| Prompt Engineering | Static template strings | Role descriptions | Passthrough | Evolvable Prompt Genomes with scoring & mutation |
| Adaptation Mechanism | None (Deterministic) | Prompt engineering | Heuristic failover | Continuous Learning Loop updating model & strategy priors |
| Memory Architecture | Buffer / Vector Index | Chat history buffer | None | 5-Layer Memory Mesh (Short, Long, Semantic, Episodic, Graph) |
| Self-Correction | Ad-hoc retry | Conversational critique | None | Dedicated Reflection & Hallucination Evaluator |
| Local-First Capability | Needs external APIs | Needs external APIs | Needs external APIs | 100% Zero-Dependency Offline-First with live API contracts |
Every user query triggers an adaptive cognitive cycle:
flowchart TD
classDef startNode fill:#0ea5e9,stroke:#0284c7,stroke-width:2px,color:#fff;
classDef processNode fill:#1e293b,stroke:#3b82f6,stroke-width:1.5px,color:#f8fafc;
classDef engineNode fill:#4c1d95,stroke:#8b5cf6,stroke-width:2px,color:#fff;
classDef feedbackNode fill:#065f46,stroke:#10b981,stroke-width:2px,color:#fff;
User([User Request / AIRequest]):::startNode --> Intent[Intent Parser]:::processNode
Intent --> Planner[Adaptive Planner]:::processNode
Planner --> Policy[Policy Engine & Budget Constraints]:::processNode
Policy --> DAG[Cognitive DAG Builder]:::engineNode
subgraph ExecutionGraph [Cognitive Graph Execution Engine]
direction TB
DAG --> TNode[Tool Nodes: Safe Calculator / Retrieval]:::processNode
TNode --> MNode[Model Router: Adaptive Prior Selection]:::processNode
MNode --> RNode[Reflection Engine: Self-Check & Critique]:::processNode
RNode --> ENode[Evaluator: Scoring & Hallucination Filter]:::processNode
end
ENode --> Mem[Memory Update: 5-Layer Mesh]:::feedbackNode
ENode --> Learn[Learner Engine: Strategy & Prior Update]:::feedbackNode
Mem --> Resp([Final Replayable Response]):::startNode
Learn --> Resp
- Requests are compiled into directed acyclic graphs containing atomic, inspectable nodes (
TOOL_CALL,MODEL_CALL,REFLECTION,EVALUATION,MEMORY_WRITE,LEARNING). - Independent nodes execute concurrently in non-blocking event loops.
- Node-level checkpoints enable pause, resume, and automated retries on transient network faults.
- Native export to Graphviz DOT format for instant visualization of execution pathways.
Prompts are not static stringsβthey are structured genomes containing:
- Identity & Instructions: Role definitions, instruction sets, and dynamic constraints.
- Self-Evaluation Criteria: Groundedness checks, uncertainty estimations, and safety bounds.
- Generational Evolution: When an execution receives low evaluation scores, the registry mutates the genome, generating improved offspring with updated instructions and tracked parentage.
- Tracks execution metrics across every interaction: latency, financial cost, quality score, and hallucination probability.
- Automatically adjusts:
- Strategy preference scores
- Prompt genome fitness priors
- Model routing weightings
- Memory retrieval importance biases
- Short-Term Memory: Working session context with automated sliding-window compression.
- Long-Term Memory: Summarized durable memory across past interactions.
- Semantic Memory: Content-based similarity retrieval using vectorized lexical signatures.
- Episodic Memory: Chronological historical traces of previous graph trajectories.
- Knowledge Graph: Triple-based relational store (
(Entity, Relation, Entity)) with deduplication.
Clone the repository and install in editable mode:
git clone https://github.com/raitulh/MindLatticeAI.git
cd MindLatticeAI
python -m pip install -e .MindLatticeAI runs 100% offline out-of-the-box using deterministic local heuristic providers:
from mindlatticeai import Agent
# Initialize default agent
agent = Agent()
# Execute request
response = agent.run("Calculate 21 * 2 and explain why DAG execution improves AI reliability.")
print("Response:\n", response.text)
print("\nMetrics:", response.metrics)
print("\nReplay ID:", response.replay_id)import asyncio
from mindlatticeai import Agent
from mindlatticeai.schemas import AIRequest, RuntimeBudget
async def main():
agent = Agent()
request = AIRequest(
input="Provide a structured overview of cognitive computing.",
budget=RuntimeBudget(
max_cost_usd=0.10,
latency_budget_ms=3000,
quality_floor=0.80
)
)
response = await agent.arun(request)
print(response.text)
asyncio.run(main())MindLatticeAI includes built-in, zero-dependency HTTP completion support for all major LLM backends. Simply export your API key:
import os
from mindlatticeai import Agent
from mindlatticeai.providers import (
GeminiProvider,
OpenAIProvider,
ClaudeProvider,
DeepSeekProvider,
OllamaProvider,
)
# Set keys
os.environ["GEMINI_API_KEY"] = "your-gemini-key"
# os.environ["OPENAI_API_KEY"] = "your-openai-key"
# os.environ["ANTHROPIC_API_KEY"] = "your-anthropic-key"
# os.environ["DEEPSEEK_API_KEY"] = "your-deepseek-key"
agent = Agent(
providers=[
GeminiProvider(model="gemini-1.5-pro"),
OpenAIProvider(model="gpt-4.1-mini"),
ClaudeProvider(model="claude-3-5-sonnet"),
DeepSeekProvider(model="deepseek-chat"),
OllamaProvider(model="llama3.1"),
]
)
response = agent.run("Explain how adaptive prior routing works.")
print(response.text)1. Custom Tool Registration
from mindlatticeai import Agent
from mindlatticeai.tools import Tool, ToolRegistry
def reverse_string(text: str) -> str:
return text[::-1]
tools = ToolRegistry()
tools.register(
Tool(
name="string_reverser",
description="Reverses any input string",
handler=reverse_string,
)
)
agent = Agent(tools=tools)2. Lifecycle Plugins & Hooks
from mindlatticeai import Agent
from mindlatticeai.plugins import PluginManager
plugins = PluginManager()
@plugins.hook("after_plan")
def log_plan(strategy):
print(f"Strategy formulated: {strategy.id} with {len(strategy.steps)} steps")
@plugins.hook("after_learn")
def log_learning(score):
print(f"Learning feedback registered: Quality Score = {score:.4f}")
agent = Agent(plugins=plugins)3. Automated Benchmarking
import asyncio
from mindlatticeai import Agent
from mindlatticeai.benchmarks import BenchmarkCase, BenchmarkSuite
async def run_eval():
agent = Agent()
suite = BenchmarkSuite([
BenchmarkCase(name="math", input="Calculate 15 * 3", expected_keywords=["45.0"]),
BenchmarkCase(name="concept", input="What is a DAG?", expected_keywords=["directed"]),
])
report = await suite.arun(agent)
print(f"Success Rate: {report.success_rate * 100:.1f}%")
print(f"Mean Latency: {report.mean_latency_ms:.2f}ms")
asyncio.run(run_eval())mindlatticeai/
βββ src/mindlatticeai/
β βββ core/ # Agent facade & RuntimeConfig
β βββ graph/ # DAG builder, concurrent execution engine, checkpoints
β βββ planner/ # Intent parsing & adaptive strategy synthesis
β βββ policy/ # Dynamic runtime policies & budget governors
β βββ prompts/ # Prompt Genome registry, scoring, & mutation
β βββ router/ # Multi-factor model router (latency, cost, prior)
β βββ learner/ # Continuous learning loop & prior updater
β βββ memory/ # 5-layer memory mesh (short, long, semantic, episodic, graph)
β βββ providers/ # Local heuristic & live API providers (OpenAI, Gemini, etc.)
β βββ reflection/ # Self-reflection critique & hallucination evaluator
β βββ tools/ # Built-in safe tools & extensible registry
β βββ cache/ # Exact & semantic similarity caches
β βββ replay/ # Execution replay & snapshot serialization
β βββ telemetry/ # Tracing, latency metrics, & DOT visualization
β βββ benchmarks/ # Evaluation suite primitives
β βββ security/ # Sandboxing & security policies
βββ tests/ # 18 Unit & Integration test suites
βββ examples/ # Executable end-to-end usage examples
βββ docs/ # In-depth architectural specifications & roadmap
MindLatticeAI comes with comprehensive test suites covering all architectural layers:
# Run complete test suite
pytest -v
# Run with test coverage
pytest --cov=mindlatticeai- DAG Execution Engine with atomic checkpoints & retries
- Evolvable Prompt Genomes with generational mutations
- 5-Layer Multi-Layer Memory Mesh
- Zero-dependency HTTP providers for OpenAI, Gemini, Claude, Ollama, DeepSeek
- Contextual Bandit reinforcement learning for model routing
- Vector database backend adapter (Qdrant, Chroma, Milvus)
- Distributed DAG workers via Redis / Celery
- Web dashboard for real-time trace, cost, and graph replay analysis
See the full Roadmap Document for details.
Contributions from the AI research and engineering community are warmly welcome! Whether it's novel graph mutation algorithms, new providers, memory backends, or benchmark datasets:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/CognitiveFeature) - Commit your Changes (
git commit -m 'Add CognitiveFeature') - Push to the Branch (
git push origin feature/CognitiveFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more details.
If you use MindLatticeAI in your academic research or production systems, please cite:
@software{mindlatticeai2026,
author = {Raitul Hasan Priyo and Contributors},
title = {MindLatticeAI: Adaptive AI Orchestration Framework with Execution-History Learning and Cognitive Graphs},
url = {https://github.com/raitulh/MindLatticeAI},
year = {2026}
}