π¦ SAL (Sub Agent Lab) v1.0.0
Maximize Python 3.12+ Performance. Save up to 50% Cloud RAM for Autonomous AI Agents.
SAL is an ultra-lightweight, zero-dependency orchestration library designed to deploy isolated Python AI Agents inside native Subinterpreters. By breaking the barrier of the traditional single-threaded GIL, SAL enables true multi-core parallel processing without spawning massive, memory-heavy processes.
Β π Why SAL?
Traditional production setups spawn multiple full Python worker processes (using multiprocessing or gunicorn/uvicorn workers) to achieve concurrency. This duplicates the internal runtime memory footprint, skyrocketing cloud costs (AWS/GCP/Docker).
SAL solves this by leveraging Python 3.12's experimental Per-Interpreter GIL (`_xxsubinterpreters`). It creates entirely isolated runtime environments on separate CPU cores inside a single process shell.
- π True Parallelism: Native execution across multi-core CPUs.
- π Memory Efficiency: Cuts down runtime RAM overhead by up to 50%.
- π€ Built for AI Agents: Perfect for running multiple long-polling, autonomous agents smoothly.
Β π Quick Start (Example Usage)
Ensure you have Python 3.12 or newer installed.
```python
from sal import SubAgentLab
sal = SubAgentLab()
Define your agent logic as a string block
agent_code = """
import time
import os
print(f"-> Agent Alpha active on Process ID: {os.getpid()} | Memory Saved!")
time.sleep(1)
"""
Deploy instantly onto an isolated subinterpreter
worker_thread = sal.deploy_agent("Alpha_Agent", agent_code)
worker_thread.join()
```
Β β οΈ Disclaimer
SAL utilizes Python's internal `_xxsubinterpreters` module. This feature is currently experimental in the standard CPython distribution and is intended for high-performance research and optimization architecture.