Metadata-Version: 2.4
Name: reasonflow
Version: 0.2.1
Summary: Reasonflow - Workflow Orchestration Framework
Home-page: https://github.com/sunnybedi990/reasonflow
Author: Sunny Bedi
Author-email: sunnybedi990@gmail.com
Project-URL: Homepage, https://github.com/sunnybedi990/reasonflow
Project-URL: Documentation, https://reasonflow.readthedocs.io
Project-URL: Repository, https://github.com/sunnybedi990/reasonflow.git
Project-URL: Issues, https://github.com/sunnybedi990/reasonflow/issues
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: reasonchain>=0.1.0
Requires-Dist: networkx>=3.1
Requires-Dist: pyyaml>=6.0
Requires-Dist: requests>=2.31.0
Requires-Dist: aiohttp>=3.8.5
Requires-Dist: playwright>=1.40.0
Requires-Dist: beautifulsoup4>=4.12.0
Requires-Dist: lxml>=4.9.0
Requires-Dist: nltk>=3.8.1
Requires-Dist: textblob>=0.17.1
Requires-Dist: readability-lxml>=0.8.1
Requires-Dist: axe-selenium-python>=2.1.6
Provides-Extra: observability
Requires-Dist: prometheus-client>=0.17.1; extra == "observability"
Requires-Dist: opentelemetry-api>=1.20.0; extra == "observability"
Requires-Dist: opentelemetry-sdk>=1.20.0; extra == "observability"
Requires-Dist: opentelemetry-exporter-otlp>=1.20.0; extra == "observability"
Requires-Dist: influxdb-client>=1.38.0; extra == "observability"
Requires-Dist: elasticsearch>=8.10.1; extra == "observability"
Requires-Dist: elasticsearch-async>=6.2.0; extra == "observability"
Requires-Dist: confluent-kafka>=2.2.0; extra == "observability"
Requires-Dist: redis>=5.0.1; extra == "observability"
Requires-Dist: aioredis>=2.0.1; extra == "observability"
Requires-Dist: aiosmtplib>=2.0.0; extra == "observability"
Provides-Extra: ai
Requires-Dist: sentence-transformers>=2.2.2; extra == "ai"
Requires-Dist: faiss-cpu>=1.7.4; extra == "ai"
Requires-Dist: torch>=2.1.0; extra == "ai"
Requires-Dist: transformers>=4.36.0; extra == "ai"
Requires-Dist: numpy>=1.24.0; extra == "ai"
Requires-Dist: pandas>=2.1.0; extra == "ai"
Requires-Dist: scikit-learn>=1.3.0; extra == "ai"
Provides-Extra: docs
Requires-Dist: python-docx>=1.0.0; extra == "docs"
Requires-Dist: PyPDF2>=3.0.0; extra == "docs"
Requires-Dist: pdfplumber>=0.10.0; extra == "docs"
Requires-Dist: pytesseract>=0.3.10; extra == "docs"
Requires-Dist: pdf2image>=1.16.3; extra == "docs"
Requires-Dist: pillow>=10.0.0; extra == "docs"
Provides-Extra: vectors
Requires-Dist: pinecone-client>=2.2.4; extra == "vectors"
Requires-Dist: pymilvus>=2.3.1; extra == "vectors"
Requires-Dist: qdrant-client>=1.7.0; extra == "vectors"
Requires-Dist: weaviate-client>=3.25.0; extra == "vectors"
Provides-Extra: llm
Requires-Dist: openai>=1.3.0; extra == "llm"
Requires-Dist: anthropic>=0.7.0; extra == "llm"
Requires-Dist: groq>=0.4.0; extra == "llm"
Provides-Extra: api
Requires-Dist: fastapi>=0.105.0; extra == "api"
Requires-Dist: uvicorn>=0.24.0; extra == "api"
Requires-Dist: httpx>=0.25.0; extra == "api"
Requires-Dist: requests>=2.31.0; extra == "api"
Requires-Dist: aiohttp>=3.9.0; extra == "api"
Requires-Dist: websockets>=12.0; extra == "api"
Provides-Extra: storage
Requires-Dist: firebase-admin>=6.2.0; extra == "storage"
Requires-Dist: boto3>=1.34.0; extra == "storage"
Requires-Dist: minio>=7.2.0; extra == "storage"
Requires-Dist: cachetools>=5.3.0; extra == "storage"
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: black>=23.12.0; extra == "dev"
Requires-Dist: isort>=5.13.0; extra == "dev"
Requires-Dist: flake8>=6.1.0; extra == "dev"
Requires-Dist: mypy>=1.7.0; extra == "dev"
Requires-Dist: pre-commit>=3.6.0; extra == "dev"
Provides-Extra: docs-build
Requires-Dist: sphinx>=7.1.0; extra == "docs-build"
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs-build"
Requires-Dist: mkdocs>=1.5.0; extra == "docs-build"
Requires-Dist: mkdocs-material>=9.5.0; extra == "docs-build"
Provides-Extra: web
Requires-Dist: playwright>=1.40.0; extra == "web"
Requires-Dist: beautifulsoup4>=4.12.0; extra == "web"
Requires-Dist: lxml>=4.9.0; extra == "web"
Requires-Dist: nltk>=3.8.1; extra == "web"
Requires-Dist: textblob>=0.17.1; extra == "web"
Requires-Dist: readability-lxml>=0.8.1; extra == "web"
Requires-Dist: axe-selenium-python>=2.1.6; extra == "web"
Requires-Dist: aiofiles>=23.2.1; extra == "web"
Requires-Dist: html5lib>=1.1; extra == "web"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: project-url
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ReasonFlow

ReasonFlow is a powerful workflow orchestration framework designed for building and managing complex AI/ML pipelines with advanced observability and tracking capabilities.

## Features

- **Workflow Orchestration**
  - Task dependency management
  - Parallel execution support
  - Error handling and retries
  - State management
  - Dynamic task configuration

- **Advanced Observability**
  - Real-time task tracking
  - Metrics collection
  - Event logging
  - Alert management
  - Health monitoring

- **Integrations**
  - Multiple LLM providers (OpenAI, Ollama, Groq)
  - Vector databases (FAISS, Milvus, Pinecone)
  - Monitoring systems (Prometheus, Kafka)
  - Alert systems (Slack, Email)

- **RAG Capabilities**
  - Document processing
  - Vector storage
  - Semantic search
  - Context management

## Installation

```bash
# Clone the repository
git clone https://github.com/yourusername/reasonflow.git
cd reasonflow

# Create and activate virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt
```

## Dependencies

### Core Dependencies
```
reasontrack>=0.1.0
reasonchain>=0.1.0
python-dotenv>=1.0.0
```

### Observability Dependencies
```
prometheus-client>=0.17.1
opentelemetry-api>=1.20.0
opentelemetry-sdk>=1.20.0
opentelemetry-exporter-otlp>=1.20.0
influxdb-client>=1.38.0
elasticsearch>=8.10.1
elasticsearch-async>=6.2.0
confluent-kafka>=2.2.0
redis>=5.0.1
aioredis>=2.0.1
aiosmtplib>=2.0.0
```

### AI/ML Dependencies
```
sentence-transformers
faiss-cpu  # or faiss-gpu for GPU support
torch
transformers
```

## Configuration

### Environment Variables
Create a `.env` file in the root directory:
```env
OPENAI_API_KEY=your_openai_api_key
GROQ_API_KEY=your_groq_api_key
SLACK_WEBHOOK_URL=your_slack_webhook_url
ALERT_EMAIL=your_alert_email
ALERT_EMAIL_PASSWORD=your_email_password
ALERT_RECIPIENTS=recipient1@example.com,recipient2@example.com
```

### ReasonTrack Configuration
Create `config/reasontrack.ini`:
```ini
[event_manager]
backend = kafka
broker_url = localhost:9092
topic_prefix = reasonflow_events_
client_id = reasonflow
batch_size = 100
flush_interval = 10

[metrics_collector]
backend = prometheus
pushgateway_url = localhost:9091
job_name = reasonflow_metrics
push_interval = 15

[alert_manager]
storage_path = alerts
retention_days = 30
severity_levels = INFO,WARNING,ERROR,CRITICAL

[alert_manager.slack]
webhook_url = ${SLACK_WEBHOOK_URL}

[alert_manager.email]
smtp_host = smtp.gmail.com
smtp_port = 587
username = ${ALERT_EMAIL}
password = ${ALERT_EMAIL_PASSWORD}
from_address = ${ALERT_EMAIL}
to_addresses = ${ALERT_RECIPIENTS}
use_tls = true

[state_manager]
storage_path = workflow_states
backend = memory
prefix = reasonflow_state_
ttl = 3600

[telemetry]
service_name = reasonflow
endpoint = localhost:4317
enable_metrics = true
enable_tracing = true

[logging]
level = INFO
format = %%(asctime)s - %%(name)s - %%(levelname)s - %%(message)s
file = logs/reasontrack.log
```

## Usage

### Basic Example
```python
from reasonflow.orchestrator.workflow_builder import WorkflowBuilder
from reasonflow.tasks.task_manager import TaskManager
from reasonchain.memory import SharedMemory

# Initialize components
shared_memory = SharedMemory()
task_manager = TaskManager(shared_memory=shared_memory)
workflow_builder = WorkflowBuilder(
    task_manager=task_manager,
    tracker_type="basic"
)

# Define workflow
workflow_config = {
    "tasks": {
        "task1": {
            "type": "llm",
            "config": {
                "agent": llm_agent,
                "params": {"prompt": "Your prompt here"}
            }
        }
    }
}

# Create and execute workflow
workflow_id = workflow_builder.create_workflow(workflow_config)
results = workflow_builder.execute_workflow(workflow_id)
```

### Advanced Example with Tracking
See `example/1_advance_tracking_example.py` for a complete example demonstrating:
- RAG integration
- Multiple LLM providers
- Advanced tracking
- Metrics collection
- Alert management

## Directory Structure
```
reasonflow/
├── config/
│   └── reasontrack.ini
├── example/
│   ├── 1_advance_tracking_example.py
│   └── 2_tracking_example.py
├── reasonflow/
│   ├── agents/
│   ├── integrations/
│   ├── observability/
│   ├── orchestrator/
│   └── tasks/
├── tests/
├── .env
├── README.md
└── requirements.txt
```

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is licensed under the MIT License - see the LICENSE file for details.

## Acknowledgments

- ReasonTrack for observability components
- ReasonChain for memory management
- All the amazing open-source libraries that make this possible
