Metadata-Version: 2.4
Name: reasoning-kernel
Version: 0.0.6
Summary: Model Synthesis Architecture (MSA) reasoning engine built on ReasoningFleet's FastAPI/Semantic Kernel foundation with NumPyro probabilistic programming
Project-URL: Homepage, https://github.com/Qredence/Reasoning-Kernel
Project-URL: Documentation, https://github.com/Qredence/Reasoning-Kernel/tree/main/docs
Project-URL: Repository, https://github.com/Qredence/Reasoning-Kernel
Project-URL: Bug Reports, https://github.com/Qredence/Reasoning-Kernel/issues
Project-URL: Source Code, https://github.com/Qredence/Reasoning-Kernel
Project-URL: Changelog, https://github.com/Qredence/Reasoning-Kernel/releases
Project-URL: Funding, https://github.com/sponsors/Qredence
Author-email: Qredence <contact@qredence.ai>
Maintainer-email: Qredence Team <contact@qredence.ai>
License: Apache-2.0
Keywords: ai,async,fastapi,machine-learning,msa,numpyro,probabilistic-programming,reasoning,semantic-kernel
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: <3.14,>=3.10
Requires-Dist: aiofiles>=24.1.0
Requires-Dist: aiohttp<4.0.0,>=3.9.0
Requires-Dist: arviz>=0.17.0
Requires-Dist: autoflake>=2.3.1
Requires-Dist: azure-ai-agents>=1.2.0b3
Requires-Dist: bcrypt>=4.0.0
Requires-Dist: bleach>=6.1.0
Requires-Dist: click>=8.1.0
Requires-Dist: daytona-sdk>=0.1.1
Requires-Dist: daytona>=0.1.1
Requires-Dist: fastapi<1.0.0,>=0.104.0
Requires-Dist: graphviz>=0.20.1
Requires-Dist: hiredis>=2.3.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: ipython>=8.37.0
Requires-Dist: itsdangerous>=2.1.0
Requires-Dist: jax-metal>=0.1.1
Requires-Dist: jax[cpu]>=0.4.20
Requires-Dist: jaxlib>=0.4.20
Requires-Dist: langcache>=0.9.9
Requires-Dist: langextract
Requires-Dist: matplotlib<3.11,>=3.8
Requires-Dist: networkx>=3.2.1
Requires-Dist: numpy>=1.24.0
Requires-Dist: numpyro>=0.15.0
Requires-Dist: openai>=1.10.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: prompt-toolkit>=3.0.51
Requires-Dist: psutil>=5.9.8
Requires-Dist: psycopg2-binary>=2.9.0
Requires-Dist: pydantic-settings>=2.1.0
Requires-Dist: pydantic<3.0.0,>=2.5.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: redis>=6.0.0
Requires-Dist: redisvl>=0.8.0
Requires-Dist: rich>=13.0.0
Requires-Dist: scipy>=1.11.0
Requires-Dist: semantic-kernel>=1.36.1
Requires-Dist: sentence-transformers>=2.2.2
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: sse-starlette>=3.0.2
Requires-Dist: structlog>=23.2.0
Requires-Dist: tabulate>=0.9.0
Requires-Dist: tenacity>=9.1.2
Requires-Dist: tiktoken>=0.11.0
Requires-Dist: tqdm>=4.67.1
Requires-Dist: typer>=0.17.3
Requires-Dist: uvicorn[standard]<1.0.0,>=0.24.0
Requires-Dist: vulture>=2.7
Requires-Dist: websockets>=15.0.1
Provides-Extra: all
Requires-Dist: aioredis>=2.0.1; extra == 'all'
Requires-Dist: aiortc>=1.9.0; extra == 'all'
Requires-Dist: azure-ai-inference>=1.0.0b6; extra == 'all'
Requires-Dist: azure-ai-projects; extra == 'all'
Requires-Dist: azure-core-tracing-opentelemetry>=1.0.0b11; extra == 'all'
Requires-Dist: azure-core>=1.29.0; extra == 'all'
Requires-Dist: azure-cosmos~=4.7; extra == 'all'
Requires-Dist: azure-identity>=1.15.0; extra == 'all'
Requires-Dist: azure-search-documents>=11.6.0b4; extra == 'all'
Requires-Dist: dapr-ext-fastapi>=1.14.0; extra == 'all'
Requires-Dist: dapr>=1.14.0; extra == 'all'
Requires-Dist: flask-dapr>=1.14.0; extra == 'all'
Requires-Dist: google-cloud-aiplatform<2.0.0,>=1.60.0; extra == 'all'
Requires-Dist: google-generativeai~=0.8; extra == 'all'
Requires-Dist: opentelemetry-api~=1.25; extra == 'all'
Requires-Dist: opentelemetry-exporter-otlp~=1.25; extra == 'all'
Requires-Dist: opentelemetry-instrumentation-fastapi~=0.46b0; extra == 'all'
Requires-Dist: opentelemetry-instrumentation-httpx~=0.46b0; extra == 'all'
Requires-Dist: opentelemetry-instrumentation-logging~=0.46b0; extra == 'all'
Requires-Dist: opentelemetry-sdk~=1.25; extra == 'all'
Requires-Dist: pandas~=2.2; extra == 'all'
Requires-Dist: prometheus-client>=0.20.0; extra == 'all'
Requires-Dist: pyarrow<22.0,>=12.0; extra == 'all'
Requires-Dist: sentence-transformers>=2.2.0; extra == 'all'
Requires-Dist: transformers>=4.36.0; extra == 'all'
Requires-Dist: types-redis~=4.6.0.20240425; extra == 'all'
Requires-Dist: usearch~=2.16; extra == 'all'
Requires-Dist: websockets<16,>=13; extra == 'all'
Provides-Extra: azure
Requires-Dist: azure-ai-inference>=1.0.0b6; extra == 'azure'
Requires-Dist: azure-ai-projects; extra == 'azure'
Requires-Dist: azure-core-tracing-opentelemetry>=1.0.0b11; extra == 'azure'
Requires-Dist: azure-core>=1.29.0; extra == 'azure'
Requires-Dist: azure-cosmos~=4.7; extra == 'azure'
Requires-Dist: azure-identity>=1.15.0; extra == 'azure'
Requires-Dist: azure-search-documents>=11.6.0b4; extra == 'azure'
Provides-Extra: dapr
Requires-Dist: dapr-ext-fastapi>=1.14.0; extra == 'dapr'
Requires-Dist: dapr>=1.14.0; extra == 'dapr'
Requires-Dist: flask-dapr>=1.14.0; extra == 'dapr'
Provides-Extra: data-io
Requires-Dist: pyarrow<22.0,>=12.0; extra == 'data-io'
Requires-Dist: usearch~=2.16; extra == 'data-io'
Provides-Extra: data-science
Requires-Dist: pandas~=2.2; extra == 'data-science'
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: flake8>=6.0.0; extra == 'dev'
Requires-Dist: isort>=5.12.0; extra == 'dev'
Requires-Dist: jupyter>=1.0.0; extra == 'dev'
Requires-Dist: mypy>=1.7.0; extra == 'dev'
Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
Requires-Dist: pytest-xdist>=3.5.0; extra == 'dev'
Requires-Dist: pytest>=7.4.0; extra == 'dev'
Requires-Dist: ruff>=0.5.0; extra == 'dev'
Provides-Extra: google
Requires-Dist: google-cloud-aiplatform<2.0.0,>=1.60.0; extra == 'google'
Requires-Dist: google-generativeai~=0.8; extra == 'google'
Provides-Extra: huggingface
Requires-Dist: sentence-transformers>=2.2.0; extra == 'huggingface'
Requires-Dist: transformers>=4.36.0; extra == 'huggingface'
Provides-Extra: observability
Requires-Dist: opentelemetry-api~=1.25; extra == 'observability'
Requires-Dist: opentelemetry-exporter-otlp~=1.25; extra == 'observability'
Requires-Dist: opentelemetry-instrumentation-fastapi~=0.46b0; extra == 'observability'
Requires-Dist: opentelemetry-instrumentation-httpx~=0.46b0; extra == 'observability'
Requires-Dist: opentelemetry-instrumentation-logging~=0.46b0; extra == 'observability'
Requires-Dist: opentelemetry-sdk~=1.25; extra == 'observability'
Requires-Dist: prometheus-client>=0.20.0; extra == 'observability'
Provides-Extra: realtime
Requires-Dist: aiortc>=1.9.0; extra == 'realtime'
Requires-Dist: websockets<16,>=13; extra == 'realtime'
Provides-Extra: redis
Requires-Dist: aioredis>=2.0.1; extra == 'redis'
Requires-Dist: types-redis~=4.6.0.20240425; extra == 'redis'
Description-Content-Type: text/markdown

# Reasoning-Kernel

Model Synthesis Architecture (MSA) for advanced AI reasoning

[![Python](https://img.shields.io/badge/Python-3.10%2B-blue)](https://www.python.org/)
[![Semantic Kernel](https://img.shields.io/badge/Semantic%20Kernel-1.35.3-purple)](https://github.com/microsoft/semantic-kernel)
[![Status](https://img.shields.io/badge/Status-Beta-yellow)](https://github.com/Qredence/Reasoning-Kernel)

[Documentation](./docs/README.md) • [Quickstart](#quickstart) • [Examples](#examples) • [API](#api)

> [!NOTE]
> This project is actively evolving. Interfaces may change before v1.0. Follow the docs for up-to-date usage.

## Overview

Reasoning-Kernel is a production-ready reasoning engine implementing the Model Synthesis Architecture (MSA) with Semantic Kernel integration, comprehensive cloud services, and enhanced natural language reasoning capabilities.

### 🚀 Unified Architecture with Semantic Kernel Integration

- **Semantic Kernel Orchestration**: Advanced planning, plugin management, and multi-agent coordination
- **MSA Plugin Architecture**: Each MSA stage as SK plugin with cloud integration
- **Multi-Agent Capabilities**: GroupChat patterns and specialized agents for complex reasoning
- **Cloud-Native Design**: Optimized for Redis Cloud, Daytona Cloud, and GPT-5 via Azure OpenAI
- **Simplified Module Structure**: Clear separation of concerns with minimal dependencies

### 🧠 Enhanced Natural Language Reasoning

- **MSA Research Patterns**: Integrated findings from msa-cogsci-2025-data repository
- **Natural Language Descriptions**: Causal structure analysis with comprehensive explanations
- **Concept Trace Generation**: Dependency mapping with topological sorting
- **Semantic Kernel Planning**: Advanced workflow orchestration and dynamic plan generation
- **Multi-Agent Collaboration**: Specialized agents for reasoning, exploration, and coordination

### ☁️ Cloud Service Integration

- **Redis Cloud**: Vector embeddings storage, knowledge graph caching, session persistence
- **Daytona Cloud**: Secure sandbox execution for NumPyro/JAX probabilistic computations
- **GPT-5 (Azure OpenAI)**: High thinking effort, automatic summarization, robust error handling

### 🏗️ Unified Architecture

- **Core**: Semantic Kernel integration, orchestration, plugin registry, agent management
- **Plugins**: MSA stages as SK plugins (parse, knowledge, graph, synthesis, inference)
- **Agents**: Multi-agent system components for specialized reasoning tasks
- **Cloud**: Integrated cloud service connectors with health monitoring
- **API/CLI**: Rich interfaces with SK-powered capabilities

## Quickstart

## Migration & Developer docs

If you migrated from a legacy kernel or are developing new SK agents, see:

- `docs/migration-from-legacy.md` - migration steps and checklist
- `docs/development/sk-agent-development.md` - how to build and register SK plugins
- `docs/development/testing-guide.md` - run tests and CI guidance

Prerequisites

- Python 3.10–3.13
- Azure OpenAI or Google AI key (choose one)
- Optional: Redis 7+ for vector memory

Install

```bash
git clone https://github.com/Qredence/Reasoning-Kernel.git
cd Reasoning-Kernel
uv venv && source .venv/bin/activate
uv pip install -e .
```

Configure environment (create .env or export)

```bash
# Azure OpenAI (example)
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_URL="redis://localhost:6379"
DEVELOPMENT=true
```

Run

```bash
# Start API
uv run uvicorn reasoning_kernel.main:app --reload --port 8000

# Use the Unified Architecture CLI
python -m reasoning_kernel.cli.enhanced_cli analyze "Analyze market volatility causes" --enhanced --verbose

# Check system health (includes SK and cloud services)
python -m reasoning_kernel.cli.enhanced_cli health

# View configuration
python -m reasoning_kernel.cli.enhanced_cli config

# Advanced usage with Semantic Kernel planning
python -m reasoning_kernel.cli.enhanced_cli analyze "Your scenario here" --use-planning --stages parse,knowledge

# Multi-agent orchestration
python -m reasoning_kernel.cli.enhanced_cli analyze "Complex scenario" --use-multi-agent --output json
```

## Examples

- Minimal script: `examples/enhanced_msa_demo.py`, `examples/msa_system_demo.py`
- Batch: `examples/batch_queries.json` and CLI batch commands
- Demos: see `examples/demos/` and top-level example scripts

> [!TIP]
> For quick recipes, see `docs/getting-started/quickstart.md` and `docs/examples/tutorials.mdx`.

## API

Start the server

```bash
uv run uvicorn reasoning_kernel.main:app --reload --port 8000
```

Sample requests (v1 stable; v2 included when available)

```bash
# v1 MSA reasoning
curl -sS -X POST http://localhost:8000/api/v1/reason \
    -H "Content-Type: application/json" \
    -d '{"query":"Analyze system failure"}'

# v2 endpoints (if present in your build)
curl -sS -X POST http://localhost:8000/api/v2/reasoning/analyze \
    -H "Content-Type: application/json" \
    -d '{"query":"Market volatility analysis"}'
```

## Architecture

- Orchestration: Semantic Kernel + plugin/manager pattern
- Pipeline: Parse → Knowledge → Graph → Synthesis → Inference
- Memory: Unified Redis service with optional PostgreSQL persistence
- Interfaces: FastAPI (v1 always; v2 when present), CLI (Click)
- Observability: Structured logging via structlog; optional OTEL extras

More in `docs/architecture/overview.md` and `docs/architecture/component_reference.mdx`.

## Configuration

### Simplified Architecture Configuration

The simplified architecture uses centralized cloud services configuration:

```bash
# Redis Cloud (Knowledge Stage)
REDIS_CLOUD_HOST=your-redis-cloud-host.com
REDIS_CLOUD_PORT=6379
REDIS_CLOUD_PASSWORD=your_redis_cloud_password
REDIS_CLOUD_USERNAME=default
REDIS_CLOUD_SSL=true
REDIS_CLOUD_VECTOR_INDEX=knowledge_vectors

# Daytona Cloud (Inference Stage)
DAYTONA_CLOUD_ENDPOINT=https://api.daytona.io
DAYTONA_CLOUD_API_KEY=your_daytona_api_key
DAYTONA_CLOUD_WORKSPACE_ID=your_workspace_id
DAYTONA_MEMORY_LIMIT=4Gi
DAYTONA_CPU_LIMIT=2
DAYTONA_TIMEOUT_SECONDS=300

# GPT-5 via Azure OpenAI (All LLM Tasks)
AZURE_OPENAI_API_KEY=your_azure_openai_key
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
AZURE_OPENAI_API_VERSION=2024-02-15-preview
AZURE_OPENAI_DEPLOYMENT_NAME=gpt-5
AZURE_OPENAI_MODEL=gpt-5
AZURE_OPENAI_THINKING_EFFORT=high
AZURE_OPENAI_ENABLE_SUMMARY=true

# Global Settings
ENABLE_CLOUD_SERVICES=true
FALLBACK_TO_LOCAL=true
REASONING_KERNEL_ENV=development
REASONING_KERNEL_LOG_LEVEL=INFO
```

### Configuration Validation

Check your configuration:

```bash
python -m reasoning_kernel_simplified.ui.cli config
python -m reasoning_kernel_simplified.ui.cli health
```

### Legacy Configuration

Configuration is loaded via dotenv + Pydantic settings.

Key vars

- Azure: AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, AZURE_OPENAI_DEPLOYMENT, AZURE_OPENAI_API_VERSION
- Google: GOOGLE_AI_API_KEY
- Memory: REDIS_URL, optional PostgreSQL vars if enabled
- Server: DEVELOPMENT=true to enable reload

Developer docs:

- Configuration guide: docs/development/configuration_guide.md
- Running locally: docs/development/running_locally.md

See docs/development/configuration_guide.md for up-to-date details.

## Development

```bash
uv pip install -e ".[dev]"
pre-commit install
uv run pytest -q
uv run ruff check . && uv run black . && uv run mypy reasoning_kernel/
```

Useful targets

- CLI help: `uv run reasoning-kernel --help`
- Batch: `uv run reasoning-kernel batch process -h`
- Sessions/history/memory commands available via CLI groups

## Troubleshooting

- Missing Azure keys: ensure required AZURE_OPENAI_* are set (see CLI error hints)
- Import errors for optional features (Daytona, v2 routers): install extras and rebuild environment
- Redis connection issues: verify REDIS_URL and that Redis is reachable

Check `docs/troubleshooting/common-issues.md` for more.

## Documentation

See `docs/README.md` for a complete guide: getting started, architecture, API, CLI, plugins, deployment, and operations.

---

## 📄 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

```text
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](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/](docs/)
- **Issues**: [GitHub Issues](https://github.com/Qredence/Reasoning-Kernel/issues)
- **Discussions**: [GitHub Discussions](https://github.com/Qredence/Reasoning-Kernel/discussions)
- **Email**: <support@qredence.ai>
- **Twitter**: [@qredence](https://twitter.com/qredence)

---

## 🌟 Star History

[![Star History Chart](https://api.star-history.com/svg?repos=Qredence/Reasoning-Kernel&type=Date)](https://star-history.com/#Qredence/Reasoning-Kernel&Date)

---

**Built with ❤️ by [Qredence](https://qredence.ai) for the AI reasoning community**

[⬆ Back to top](#reasoning-kernel)
