Skip to main content

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

License Python Semantic Kernel Status

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

Core Concepts

Architecture & System Design

API Documentation

MSA Plugins (Core Components)

Development & Integration

Operations & Production

Additional Resources


๐Ÿ—บ๏ธ 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


๐ŸŒŸ Star History

Star History Chart


Built with โค๏ธ by Qredence for the AI reasoning community

โฌ† Back to top

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

reasoning_kernel-0.0.4.tar.gz (296.1 kB view details)

Uploaded Source

Built Distribution

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

reasoning_kernel-0.0.4-py3-none-any.whl (365.2 kB view details)

Uploaded Python 3

File details

Details for the file reasoning_kernel-0.0.4.tar.gz.

File metadata

  • Download URL: reasoning_kernel-0.0.4.tar.gz
  • Upload date:
  • Size: 296.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.9

File hashes

Hashes for reasoning_kernel-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9b2cb345ba53554358c58f764817e061140f168d8aa8e9b8d778429231c08dac
MD5 da350f4ad4cdcb18d94b733140c75576
BLAKE2b-256 a4439ab41dd1afd5c1677129158dd4b9e19022d3fbc2539e2cddd174855d5942

See more details on using hashes here.

File details

Details for the file reasoning_kernel-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for reasoning_kernel-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b9f6750c4ed6739bbd48dc5be349286d97615d9b864c142a44702421aa70f1c5
MD5 03f26e69bc6509cc9bf2b5a3c590d3e6
BLAKE2b-256 4f828cdf547da5a946cfd03f4ba15320d22fbf46da5abd3b5a28ea321475b8da

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