Skip to main content

SAGE - Streaming-Augmented Generative Execution (meta package)

Project description

SAGE - Streaming-Augmented Generative Execution

A declarative, composable framework for building transparent LLM-powered systems through dataflow abstractions.

📚 Documentation Note: Links referencing docs-public/ point to the SAGE-Pub repository, which contains comprehensive documentation. Clone it separately if needed: git clone https://github.com/intellistream/SAGE-Pub.git

🚀 Quick Start

Try SAGE Studio

pip install isage-studio
sage-studio start

Build & Test codecov License Python PyPI version GitHub Issues GitHub Stars

SAGE is a high-performance streaming framework for building AI-powered data processing pipelines. Transform complex LLM reasoning workflows into transparent, scalable, and maintainable systems through declarative dataflow abstractions.

Key Features

  • Production-Ready: Distributed processing, fault tolerance, comprehensive monitoring
  • Developer Experience: Complex AI pipelines in just a few lines of code
  • High Performance: Optimized streaming with intelligent memory management
  • Observable: Built-in visibility into execution and performance
  • Flexible: CPU-only or GPU nodes with intelligent resource scheduling

Quick Start

Transform rigid LLM applications into flexible, observable workflows. Traditional imperative approaches create brittle systems:

# Traditional approach - rigid and hard to modify
def traditional_rag(query):
    docs = retriever.retrieve(query)
    if len(docs) < 3:
        docs = fallback_retriever.retrieve(query)
    prompt = build_prompt(query, docs)
    response = llm.generate(prompt)
    return response

SAGE transforms this into a declarative, composable workflow:

from sage.kernel.api.local_environment import LocalEnvironment
from sage.libs.foundation.io.source import FileSource
from sage.middleware.operators.llm import SageLLMGenerator  # ✅ Recommended
from sage.libs.foundation.io.sink import TerminalSink

# Create execution environment
env = LocalEnvironment("rag_pipeline")

# Build declarative pipeline with sageLLM (recommended)
(
    env.from_source(FileSource, {"data_path": "questions.txt"})
    .map(SageLLMGenerator, {
        "model_path": "Qwen/Qwen2.5-7B-Instruct",
        "backend_type": "auto",  # auto/cuda/ascend/mock
    })
    .sink(TerminalSink)
)

# Execute pipeline
env.submit()

💡 LLM Engine: SAGE uses sageLLM as the default inference engine. For OpenAI-compatible APIs, use OpenAIGenerator. See CHANGELOG for legacy migration notes.

Current API quick reference

  • sage.libs.foundation.io.source: FileSource, TextFileSource, CSVFileSource, JSONFileSource
  • sage.libs.foundation.io.sink: TerminalSink, FileSink
  • sage.middleware.operators.rag: RAGDocument, RAGQuery, RAGResponse
  • sage.middleware.operators.llm: SageLLMGenerator

Try it yourself:

git clone https://github.com/intellistream/SAGE.git && cd SAGE
git checkout main-dev
./quickstart.sh --dev --yes

# Tutorials are now in a separate repository
git clone https://github.com/intellistream/sage-tutorials.git
python sage-tutorials/L1-common/hello_world.py

For CPU-only deployment:

# Start JobManager for distributed task execution
sage jobmanager start

# Run CPU node demo (no GPU required)
git clone https://github.com/intellistream/sage-tutorials.git
python sage-tutorials/L3-kernel/cpu_node_demo.py

Architecture

SAGE has a 5-layer core architecture (L1-L5) with each core layer independently released as its own package:

L5: sage-cli                          # CLI & Dev Tools       (isage-cli)
L4: sage-middleware                   # Operators / C++ ext   (isage-middleware)
L3: sage-kernel, sage-libs            # Runtime & algorithms  (isage-kernel, isage-libs)
L2: sage-platform                     # Queue, storage        (isage-platform)
L1: sage-common                       # Foundation            (isage-common)

Above the core stack, ecosystem repositories (applications, benchmarks, docs, websites) are classified as L6.

See SAGE Ecosystem for all independent sub-repositories with CI status, PyPI packages, and categorized listings.

📖 Architecture Guide - Detailed design principles and dependency rules

📌 Layer Ownership Matrix v1 (Wave A) - Canonical L1-L5 ownership, independent sub-repo coordination boundary (including sagellm capabilities), forbidden directions, and boundary refactor review checklist

Installation

Quickstart (Recommended)

git clone https://github.com/intellistream/SAGE.git && cd SAGE
./quickstart.sh --dev --yes         # 开发模式:尽量本地 editable
# 或
./quickstart.sh --standard --yes    # 标准模式:子包依赖默认从 PyPI 安装

Auto-Acceleration: Network optimization is now enabled by default:

  • 🌐 Auto-detects network location (China mainland → mirror sources)
  • 🚀 Parallel downloads (8 threads) + pre-compiled packages
  • ⏱️ 3-5x faster installation: 12-18 min (vs 35-45 min)
  • 🔧 Disable: ./quickstart.sh --no-mirror --dev --yes

Install Mode Semantics

  • standard:本地安装仓库根目录下的 isage meta 包,子仓依赖按根 pyproject.toml 版本从 PyPI 解析。
  • dev:先完成 standard 安装,再尽量将同级工作区中的本地 SAGE 子仓库切换为 editable (-e)。

PyPI Install

pip install isage              # Core framework
pip install isage[dev]         # Development tools (includes isage-dev-tools, pre-commit, pytest, etc.)

What's included in pip install isage

isage is a meta-package that bundles the full framework stack: isage-common (L1) · isage-platform (L2) · isage-kernel + isage-libs (L3) · isage-middleware (L4) · isage-cli (L5) · isage-flow (runtime) · isagellm (LLM gateway)

Capability Packages (bundled with isage) 🧩

For a standard pip install isage, these packages are installed transitively and do not require extra manual installation:

Feature Included Package Notes
Agents isage-agentic ReAct, PlanExecute, complex reasoning
Vector DB isage-vdb Fast vector search (SageVDB)
Memory Systems isage-neuromem Persistent memory + sessions
Privacy isage-privacy Differential privacy, PII handling
LLM Gateway isagellm Control plane, unified inference client

Optional packages (not bundled — install separately) 🦁

These packages were moved to independent repositories and are no longer part of the default isage install. See SAGE Zoo guide for the full list with one-liner descriptions and install commands.

pip install isage-rag              # RAG 管道(文档加载 / 分块 / 检索 / 重排)
pip install isage-eval             # 评估框架(指标 / LLM 评判)
pip install isage-finetune         # LLM 微调 / Agent training(LoRA / SFT / RL / Reward Model)
pip install isage-agentic-tooluse  # Agent 工具选择(Hybrid/DFS/Gorilla)
pip install isage-intent           # 意图识别(关键词 + LLM)
pip install 'isage-tools[mcp]'     # 独立工具仓库;当前已注册到 sage-mcp
pip install 'isage-mcp[all]'       # 聚合 MCP Server(当前默认聚合 isage-tools)

Example: install full core SAGE stack

pip install isage

See Dependency Management in DEVELOPER.md for detailed guidance.

Verification & Troubleshooting

sage doctor                    # Check installation
./quickstart.sh --doctor       # Diagnose issues

📖 Detailed guides: Installation Guide | Troubleshooting | Validation | Optimization Tips

⚠️ Known Issues: If you encounter transformers version conflicts when installing multiple SAGE packages, see Dependency Fix Guide

Environment Configuration

cp .env.template .env    # Copy template
# Edit .env and add your API keys (OPENAI_API_KEY, HF_TOKEN, etc.)

📖 API key setup: See .env.template for all available options

📚 Tutorials

Complete tutorials covering all layers of SAGE (L1-L5):

# Clone tutorials repository
git clone https://github.com/intellistream/sage-tutorials.git
cd sage-tutorials

# Start learning (30 seconds)
python L1-common/hello_world.py

# Follow the quick start guide
cat QUICK_START.md

Tutorial Structure:

  • sage-tutorials/L1-common/ - Foundation layer (config, logging, unified client)
  • sage-tutorials/L2-platform/ - Platform services (scheduler, storage)
  • sage-tutorials/L3-kernel/ - Execution engine (batch, stream, operators)
  • sage-tutorials/L3-libs/ - RAG, Agents, Algorithms
  • sage-tutorials/L4-middleware/ - Domain operators (vector DB, time-series)
  • sage-tutorials/L5-apps/ - Applications and integration demos

See sage-tutorials/README.md for complete learning paths.

Documentation & Resources

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

git checkout -b feature/my-feature
./quickstart.sh --dev --yes
# Make changes, add tests
sage-dev quality && sage-dev test
git commit -m "feat(kernel): add new feature"
git push -u origin feature/my-feature

Resources: Quick Reference | GitHub Issues | Discussions

Team Information

🔒 Team assignments and sensitive information are maintained in a private repository to protect member privacy.

  • Public: Project-level information is available in this repository
  • Private: Team member assignments, funding details, and contact information are accessible to authorized members only
  • Access: Contact project management for access to the private repository

Developer Tools

make help           # View all commands
sage-dev quality    # Format & lint
sage-dev test       # Run tests
make docs           # Build documentation

📖 Complete reference: DEVELOPER.md

SAGE Ecosystem

📦 SAGE Zoo guide — 独立可选包(已 zoo 化,各自独立演进)

🧠 SAGE — Streaming AI Framework

CI PyPI Python Stars

SAGE is a streaming AI framework decomposed into 5 independently-released layer packages:

Core Layers

  • sage-common (L1) — Foundation utilities, config, logging CI PyPI Stars
  • sage-platform (L2) — Queue, storage, and service abstractions CI PyPI Stars
  • sage-kernel (L3) — Streaming runtime, scheduler, flow DSL CI PyPI Stars
  • sage-libs (L3) — Algorithm library (RAG, agents, ANNS interfaces) CI PyPI Stars
  • sage-middleware (L4) — Domain operators with C++ extensions CI PyPI Stars
  • sage-cli (L5) — Unified CLI and developer tooling CI PyPI Stars

Independent sub-repositories are organized by category:

Application & UI

Algorithms & Libraries

  • sage-agentic — ReAct, PlanExecute agents and agentic workflows CI PyPI Stars
  • sage-rag — Retrieval-augmented generation components CI PyPI Stars
  • sageVDB — High-performance vector database (FAISS-compatible API) CI PyPI Stars
  • sageRefiner — Query and response refinement algorithms CI PyPI Stars
  • sage-amms — Approximate matrix multiplication service CI PyPI Stars
  • sageFlownet — Streaming flownet execution engine 🔒 private CI PyPI

Data & Benchmarks

  • sageData — Unified dataset management for SAGE subsystems CI PyPI Stars
  • sage-benchmark — Comprehensive evaluation framework for RAG, agents, memory, and control plane CI PyPI Stars
  • sage-eval — Evaluation metrics, profilers, and LLM judges CI PyPI Stars

Model Optimization & Safety

Developer Tooling


⚡ sageLLM — LLM Inference Engine

CI PyPI Python

sageLLM is a modular, high-performance LLM inference engine. All repositories are 🔒 private and published to PyPI.

Core Engine

Gateway & Control

Optimization

Tooling & Benchmarks

Community

💬 Join SAGE Community - WeChat, QQ, Slack, GitHub Discussions

License

SAGE is licensed under the MIT License.

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

isage-0.2.4.34.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

isage-0.2.4.34-py2.py3-none-any.whl (13.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file isage-0.2.4.34.tar.gz.

File metadata

  • Download URL: isage-0.2.4.34.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for isage-0.2.4.34.tar.gz
Algorithm Hash digest
SHA256 7a68ca5bf43aa6b78484c4b1001c5272dbca08c1e32b47835e95a2a7832404fc
MD5 72d612681a94708a6f265122c18a5572
BLAKE2b-256 99cf1906cc2bcff0db7102aeae9f986c3f1a7ceb1fb81dc1d776d651be69cb79

See more details on using hashes here.

File details

Details for the file isage-0.2.4.34-py2.py3-none-any.whl.

File metadata

  • Download URL: isage-0.2.4.34-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for isage-0.2.4.34-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7ace5b9f0f543fafd2b67ed55d7342c1611c0444f73d23fee3b95eef5bc7ebb1
MD5 fecc6e7c7fcbd2051109d3d002cf843d
BLAKE2b-256 13d2e95ec63073eed2cd9135e07e6a062a3b4242b0c65e5f8b3554f6abc5efe6

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