Skip to main content

LightChat is a deterministic, secure, and production-grade runtime for controlled conversational processes.

Project description

LightChat

LightChat is a lightweight, high-performance runtime and orchestration framework for managing multiple local processes, including AI/LLM models. It provides safe process execution, resource monitoring, structured logging, and real-time metrics collection. Designed for developers and researchers working with multiple local models or scripts, LightChat makes managing and observing processes simple and reliable.


Features

  • Lightweight and efficient process management.
  • Safe multi-process orchestration with graceful and hard termination.
  • CPU, memory, and execution-time monitoring for each process.
  • Structured logging with correlation IDs for easy tracing.
  • Metrics collection and reporting for debugging and optimization.
  • Compatible with Python 3.10+.
  • Designed for testing local AI/ML/LLM models or any custom scripts safely.

Installation

# Clone the repository
git clone https://github.com/yourusername/lightchat.git
cd lightchat

# Optional: create a virtual environment
python -m venv venv
source venv/bin/activate  # Linux/macOS
venv\Scripts\activate     # Windows

# Install requirements
pip install -r requirements.txt
Quick Start
python
Copy code
import time
from lightchat.api.runtime import Runtime
from lightchat.config.core import ConfigLoader

# Load configuration
config_loader = ConfigLoader()
config = config_loader.get()

# Initialize runtime
runtime = Runtime(config=config)

# Create a process
proc = runtime.create_process(
    name="hello_world",
    command=["python", "-c", "print('Hello, LightChat!')"]
)

# Start and wait
proc.start()
proc.wait()

# Get metrics
print(proc.metrics())
print(proc.status())
API Overview
Runtime
Create, start, and manage multiple processes.

Query all process statuses and metrics.

Stop or kill processes individually.

ProcessHandle
Represents a single process with monitoring.

Methods:

start(), stop(), kill()

wait(timeout=None)  Waits for completion.

status()  Returns current process state.

metrics()  Returns CPU, memory usage, and process state.

LightChatLogger
Structured logging with correlation IDs.

Thread and multi-process safe.

MetricsCollector
Collects CPU, memory, execution-time metrics for processes.

Useful for optimization and monitoring experiments.

Use Case
LightChat is ideal for:

Testing multiple LLM or AI models locally.

Running resource-heavy scripts with monitoring.

Debugging and profiling Python processes.

Building experimental ML pipelines safely.

Example: Running multiple small LLM models locally and observing resource consumption in real-time.

Acknowledgements
This project leverages the following Python libraries and tools:

psutil  For process and system resource monitoring.

uuid  For generating unique correlation IDs.

Python logging module  Structured logging for observability.

contextvars  Context-aware correlation IDs for multi-process logging.

Contributing
Contributions are welcome! Please fork the repository and submit a pull request.

Bug reports, performance improvements, and new features are encouraged.

Follow PEP-8 and Python 3.10+ compatibility.

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

lightchat-1.0.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

lightchat-1.0.0-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file lightchat-1.0.0.tar.gz.

File metadata

  • Download URL: lightchat-1.0.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for lightchat-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1d38f16d71dcd74d0337efc2e69dd3e678ccd8b104693ca404aa7fb323007966
MD5 308a3078863ca421da1f2c3e941ed198
BLAKE2b-256 f9a0c46bb70fa80fc20c87ee22a5db1cf4ca68cccbfb3906159e69db7918d24b

See more details on using hashes here.

File details

Details for the file lightchat-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: lightchat-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for lightchat-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7459927d0a8adfe472ac1707fd7eb0a051de965bc55b093d37f8eaac9154f2e3
MD5 e3d98eaf87c604ea5453df321d10d51b
BLAKE2b-256 683dfdfae9df61c8ea6475b03b13aa3db0c9ce4d99cdf1dc5e905422907aa8d6

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