Model Synthesis Architecture (MSA) reasoning engine built on ReasoningFleet's FastAPI/Semantic Kernel foundation with NumPyro probabilistic programming
Project description
๐ง Reasoning-Kernel
Model Synthesis Architecture (MSA) for Advanced AI Reasoning
An enterprise-grade probabilistic reasoning system built on Microsoft Semantic Kernel and NumPyro
Documentation โข Quick Start โข Roadmap โข Contributing
โ ๏ธ Work in Progress Notice
This project is under active development. APIs, configurations, and features may change without notice. We're working towards a stable v1.0 release. See our roadmap for planned features and timeline.
Current Status: Beta (v0.0.2) - Core functionality stable, enterprise features in development
๐ Overview
Reasoning-Kernel implements the Model Synthesis Architecture (MSA) - a cutting-edge approach to AI reasoning that combines:
- ๐ฏ Semantic Kernel Integration: Native Microsoft SK 1.35.3 orchestration with agent-based patterns
- ๐ Probabilistic Programming: NumPyro/JAX for Bayesian inference with Daytona sandbox execution
- ๐ 5-Stage Reasoning Pipeline: Parse โ Knowledge โ Graph โ Synthesis โ Inference
- ๐พ Multi-Tier Memory: Redis vector store with Gemini embeddings + PostgreSQL for persistent knowledge
- ๐ Production Ready: FastAPI, async processing, enterprise security, and horizontal scaling
Key Differentiators
- Causal Reasoning: Build and reason over causal dependency graphs
- Uncertainty Quantification: Probabilistic models with confidence intervals and Daytona sandbox execution
- Explainable AI: Transparent reasoning traces and decision paths with Gemini 2.5 Pro thinking modes
- Multi-Model Support: Azure OpenAI, Google Gemini 2.5 Pro, local models
- Scalable Architecture: Horizontal scaling with multi-agent orchestration and Redis memory consolidation
- Secure Execution: Daytona sandbox for safe code execution in reasoning workflows
- Advanced Embeddings: Gemini text-embedding-004 for enhanced semantic search
๐ Quick Start
Prerequisites
- Python 3.10-3.12 (3.13+ not yet supported)
- Azure OpenAI or Google AI API credentials
- Redis 7.0+ (optional, for vector memory)
- 8GB+ RAM recommended
Installation
# Clone repository
git clone https://github.com/Qredence/Reasoning-Kernel.git
cd Reasoning-Kernel
# Create virtual environment (recommended: uv)
uv venv && source .venv/bin/activate # or: python -m venv .venv
# Install with core dependencies
uv pip install -e .
# Install with optional features
uv pip install -e ".[azure,google,redis]" # Pick what you need
Configuration
Create a .env file or export environment variables:
# Required: Choose one AI provider
# Azure OpenAI (recommended)
AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
AZURE_OPENAI_API_KEY="your-key"
AZURE_OPENAI_DEPLOYMENT="gpt-4"
AZURE_OPENAI_API_VERSION="2024-12-01-preview"
# OR Google AI
GOOGLE_AI_API_KEY="your-gemini-key"
# Optional: Redis for memory
REDIS_URL="redis://localhost:6379"
Basic Usage
Python API
import asyncio
from reasoning_kernel import ReasoningKernel, ReasoningConfig
async def main():
# Initialize with default configuration
kernel = ReasoningKernel()
# Perform reasoning
result = await kernel.reason(
query="A supply chain disruption has occurred. Analyze impacts.",
mode="synthesis" # Options: knowledge, probabilistic, synthesis
)
print(f"Confidence: {result.confidence:.2%}")
print(f"Reasoning: {result.explanation}")
asyncio.run(main())
CLI Interface
# Basic reasoning query (simple CLI - lightweight)
python simple_reasoning_cli.py "Analyze market volatility causes"
# Full-featured CLI (requires all dependencies)
reasoning-kernel "Analyze market volatility causes"
# Interactive session
reasoning-kernel --interactive
# Batch processing
reasoning-kernel batch process queries.jsonl --output results.json
# Start API server
reasoning-kernel serve --port 8000
REST API
# Start server
uvicorn reasoning_kernel.main:app --reload
# Query endpoint
curl -X POST http://localhost:8000/api/v2/reason \
-H "Content-Type: application/json" \
-d '{"query": "Analyze system failure", "mode": "synthesis"}'
๐๏ธ Architecture
System Overview
graph TB
subgraph "Input Layer"
NL[Natural Language Query]
API[REST API]
CLI[CLI Interface]
end
subgraph "Orchestration Layer"
SK[Semantic Kernel 1.35.3]
AM[Agent Manager]
PM[Plugin Manager]
end
subgraph "MSA Pipeline"
P[1. Parse]
K[2. Knowledge]
G[3. Graph]
S[4. Synthesis]
I[5. Inference]
end
subgraph "Storage Layer"
Redis[(Redis Vector)]
PG[(PostgreSQL)]
Mem[Memory Service]
end
NL --> SK
API --> SK
CLI --> SK
SK --> P
P --> K --> G --> S --> I
K <--> Mem
Mem --> Redis
Mem --> PG
Core Components
| Component | Description | Status |
|---|---|---|
| Semantic Kernel Core | Microsoft SK 1.35.3 orchestration | โ Stable |
| MSA Pipeline | 5-stage reasoning process | โ Stable |
| Agent System | Multi-agent orchestration | ๐ง Beta |
| Memory Service | Redis + PostgreSQL integration | โ Stable |
| Probabilistic Engine | NumPyro/JAX inference | โ Stable |
| API Layer | FastAPI REST endpoints | โ Stable |
| CLI Tools | Command-line interface | ๐ง Beta |
| Monitoring | OpenTelemetry observability | ๐ Planned |
๐ Documentation
๐ Documentation
Getting Started
- Quick Start Guide - 10-minute introduction to MSA reasoning
- Installation Guide - Complete setup with environment configuration
- Configuration Reference - All configuration options and environment variables
Core Concepts
- MSA Framework Overview - Model Synthesis Architecture fundamentals
- Reasoning Modes - Knowledge, probabilistic, and synthesis reasoning
- Prompt Engineering - Optimizing queries for MSA pipeline
Architecture & System Design
- System Architecture - Complete system design and data flow
- Component Reference - Detailed component documentation
- Security Architecture - Security features and threat model
- Plugin Architecture - MSA plugin system design
API Documentation
- REST API Reference - Complete API endpoints and examples
- CLI Commands - Command-line interface guide
- Python SDK - Python client library documentation
MSA Plugins (Core Components)
- Parse Plugin - Natural language query parsing
- Knowledge Plugin - Knowledge retrieval and context building
- Graph Plugin - Causal relationship modeling
- Synthesis Plugin - Multi-perspective reasoning synthesis
- Inference Plugin - Probabilistic inference and uncertainty quantification
- Memory Plugin - Persistent memory and knowledge consolidation
Development & Integration
- Developer Guide - Development setup and best practices
- Plugin Development Guide - Creating custom MSA plugins
- Integration Examples - Real-world usage patterns and integrations
- Memory Management - Redis vector store and PostgreSQL integration
Operations & Production
- Production Deployment - Enterprise deployment strategies
- Performance Monitoring - Metrics, optimization, and scaling
- Troubleshooting Guide - Common problems and solutions
- Kubernetes Deployment - Container orchestration and scaling
Additional Resources
- Examples & Tutorials - Comprehensive usage examples and tutorials
- Security Best Practices - Security implementation guide
- Testing Guide - Testing strategies and frameworks
๐บ๏ธ Roadmap
Phase 1: Foundation (Q1 2025) โ COMPLETED
- Core MSA pipeline implementation
- Semantic Kernel 1.35.3 integration
- Basic agent orchestration
- Redis memory integration
- FastAPI endpoints
Phase 2: Stabilization (Q2 2025) โ COMPLETED
- Codebase simplification (86% reduction)
- API v2 stabilization
- Comprehensive test coverage (target: 90%)
- Performance optimization
- Documentation completion
- Daytona sandbox integration
- Redis memory consolidation
- Gemini 2.5 Pro integration
Phase 3: Production Ready (Q3 2025) ๐ง IN PROGRESS
- v1.0.0 stable release
- Kubernetes deployment manifests
- Horizontal scaling support
- OpenTelemetry integration
- Admin dashboard
- Multi-tenant architecture prototype
Phase 4: Advanced Features (Q4 2025) ๐ฎ FUTURE
- Multi-modal reasoning (images, audio)
- Federated learning support
- Real-time streaming reasoning
- AutoML for model synthesis
- Quantum computing integration
Phase 5: Enterprise Features (2026) ๐ฏ VISION
- Multi-tenant architecture
- RBAC and SSO integration
- Compliance certifications (SOC2, ISO)
- SLA guarantees
- Enterprise support tiers
๐งช Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=reasoning_kernel --cov-report=html
# Run specific test categories
pytest -m "not integration" # Skip integration tests
pytest -m "benchmark" # Run benchmarks only
# Run with parallel execution
pytest -n auto
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
# Clone and setup
git clone https://github.com/Qredence/Reasoning-Kernel.git
cd Reasoning-Kernel
# Install development dependencies
uv pip install -e ".[dev]"
# Setup pre-commit hooks
pre-commit install
# Run code quality checks
make lint # Run linters
make format # Format code
make typecheck # Type checking
Contribution Areas
- ๐ Bug Fixes: Help us squash bugs
- ๐ Documentation: Improve docs and examples
- ๐งช Testing: Increase test coverage
- ๐ Features: Implement roadmap items
- ๐จ UI/UX: Improve CLI and web interfaces
๐ Performance Benchmarks
| Metric | Value | Target |
|---|---|---|
| Reasoning Latency (P50) | 0.8s | <1s |
| Reasoning Latency (P99) | 2.1s | <3s |
| Throughput | 85 req/s | 100 req/s |
| Memory Usage | 1.5GB | <4GB |
| Startup Time | 3s | <3s |
| Concurrent Agents | 25 | 50 |
Benchmarks on: Azure Standard_D4s_v3, 4 vCPU, 16GB RAM
๐ Security
Security Features
- API Key Authentication: Secure API access
- Rate Limiting: Prevent abuse
- Input Validation: Pydantic models
- Audit Logging: Track all operations
- Secret Management: Azure Key Vault support
Reporting Security Issues
Please report security vulnerabilities to: security@qredence.ai
๐ License
Copyright 2025 Qredence
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
See LICENSE for the full license text.
๐ Acknowledgments
- Microsoft Semantic Kernel Team - For the excellent orchestration framework and agent patterns
- NumPyro/JAX Teams - For probabilistic programming infrastructure
- FastAPI Team - For the modern web framework
- Google Gemini Team - For advanced AI models and thinking modes
- Daytona Team - For secure sandbox execution environment
- Open Source Community - For continuous support and contributions
๐ Support & Contact
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@qredence.ai
- Twitter: @qredence
๐ Star History
Built with โค๏ธ by Qredence for the AI reasoning community
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reasoning_kernel-0.0.3.tar.gz.
File metadata
- Download URL: reasoning_kernel-0.0.3.tar.gz
- Upload date:
- Size: 303.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2acb823d8f3b511ee80a8a95d42de2edc7f0371e9d8b280c9afa56d1944b8be5
|
|
| MD5 |
159220b95be2157bc00c053ed01b8282
|
|
| BLAKE2b-256 |
5da02279ddd098f8631e6ad7091e2d1ec632511d6e6ba6079fc2608503dc4db5
|
File details
Details for the file reasoning_kernel-0.0.3-py3-none-any.whl.
File metadata
- Download URL: reasoning_kernel-0.0.3-py3-none-any.whl
- Upload date:
- Size: 376.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc7d0790cc6d2bfb866aa4ce4e021cbaae010135cef5e71c08a73c700dceca40
|
|
| MD5 |
8e5ff3b53ddedfe8a8bad9ef7445e084
|
|
| BLAKE2b-256 |
a19deb7718c5cd0ef2b57e41e8be8582eea3d087cef1a511db46654a68b5687d
|