AMV-AIChain

Why LangChain on Termux? Bloat & Crash vs 94KB Zero-Dep LCEL & Hardware Native Agents

PyPI Version npm Version License Platform
1-Line Quick Installation

Install the official package directly into your runtime:

pip install amv-aichain
# or:
npm install amv-aichain

The Engineering Challenge

Standard enterprise frameworks (LangChain, LlamaIndex, CrewAI) pull in 45+ heavy dependencies (Pydantic-core, Chroma, Tiktoken) weighing 200MB+ that constantly fail to compile on Android Bionic ARM64 and trigger instant Out-Of-Memory (LMK) kernel kills.

The Architectural Breakthrough

AMV-AIChain provides 100% pure standard-library LCEL pipe chaining (prompt | llm | parser), autonomous StateGraph agents, on-device SQLite vector RAG, and first-class Android smartphone hardware actuation (battery, temperature, haptics, GPS) in a tiny 94KB footprint.

Key Capabilities & Built-in Hardening

Zero External Dependencies (94KB)

Written entirely in Python stdlib (urllib, sqlite3, json) and Node.js ESM. No C/Rust compiler required on Android Bionic ARM64.

LCEL Pipeline Compatibility

Full Runnable Protocol support with the pipe operator (prompt | llm | parser) and real-time streaming chunk emission.

Native Smartphone Hardware Actuation

Built-in first-class tools for Android kernel battery, surface temperature, GPS coordinates, haptic vibration, and system notifications.

On-Device SQLite Vector Store (RAG)

Embeddings storage and pure-math cosine similarity search in SQLite :memory: or local DB without ChromaDB or FAISS.

Supported Compute Kernels & Operations

Subsystem Category Operations & Kernels Status
LCEL Pipe Protocol PromptTemplate | Model | OutputParser Runnable Sequence Production
Autonomous Agents StateGraph, create_react_agent, ToolPolicy(default='deny') Production
Hardware Actuation Battery, Temperature, GPS, Vibration, Notifications, Shell Production
Vector Store & RAG SQLiteVectorStore with Pure Math Cosine Similarity Production
Dual Runtime Parity Pure Python 3.10+ Stdlib & Pure Node.js 18+ ESM Production

Canonical Usage Example

from amv_aichain import PromptTemplate, OpenAICompatibleChat, StringOutputParser, get_battery_status

# 1. Read physical smartphone hardware telemetry
battery = get_battery_status()

# 2. Build LCEL Chain connected to local llama-server (port 8080)
prompt = PromptTemplate.from_template("Phone Telemetry: {status}. Diagnose in 1 sentence:")
llm = OpenAICompatibleChat(base_url="http://127.0.0.1:8080/v1", model="llama3", temperature=0.3)
chain = prompt | llm | StringOutputParser()

# 3. Execute with 0 external dependencies
report = chain.invoke({"status": battery})
print("AI Diagnostic:", report)

Getting Started & Deep Guides