Skip to main content

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

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

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:

[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

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

Metadata

Release files for reasonflow 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reasonflow 0.2.1
File Size Uploaded
reasonflow-0.2.1.tar.gz 102.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for reasonflow 0.2.1
File Interpreter ABI Platform
reasonflow-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 186.8 kB

Release files / reasonflow-0.2.1.tar.gz

Download URL reasonflow-0.2.1.tar.gz
Size 102.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e120920da8c022011ed1c531428f12529f058b3b7f8450e10702bbf81b40890e
BLAKE2b-256 checksum
How to use checksums
f067db6d00f40ce96d84c64310bbb394ac5cab67c0335d67ce1e9fbd7324a5cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.2

Release files / reasonflow-0.2.1-py3-none-any.whl

Download URL reasonflow-0.2.1-py3-none-any.whl
Size 83.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17c3cd77c420fb383db353c6c183bc3de5e9ddafb60f686a9765b7e7b07114c4
BLAKE2b-256 checksum
How to use checksums
83ce667ad7967831d724f82d919b2e988e70d065a6719c77f32b7045b64d3f85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.2

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page