Skip to main content

Agent Development Kit with 5 cognitive pillars: Topology, Tools, Memory, Evolution, Strategy

Project description

sage-python

Python SDK for YGN-SAGE (Self-Adaptive Generation Engine) -- an Agent Development Kit built on five cognitive pillars: Topology, Tools, Memory, Evolution, Strategy.

Installation

cd sage-python
pip install -e ".[all,dev]"    # All providers + dev tools
pip install -e ".[google]"     # Google Gemini only
pip install -e ".[z3]"         # Z3 formal verification

Requires Python 3.12+.

Quick Start

from sage.boot import boot_agent_system

system = boot_agent_system()           # Auto-detects Codex CLI or Gemini
result = await system.run("Solve X")   # S1/S2/S3 routing + full agent loop

Testing

python -m pytest tests/ -v             # Unit tests (1426 passed, 111 skipped, 7 pre-existing failures)
ruff check src/                        # Lint
mypy src/                              # Type check
python -m sage.bench --type routing    # Routing benchmark (no API key needed)
python -m sage.bench --type humaneval  # HumanEval 164 (needs LLM provider)
python -m sage.bench --type evalplus --dataset humaneval   # EvalPlus HumanEval+ (80x harder)
python -m sage.bench --type evalplus --dataset mbpp         # EvalPlus MBPP+ (35x harder)
python -m sage.bench --type ablation --limit 20             # Ablation study (6 configs)
python -m sage.bench.eval_protocol --suite humaneval -v     # Official evaluation protocol

Package Structure

Subpackage Description
sage/ Core runtime: boot sequence, agent loop, resilience
sage/agents/ Composition patterns: sequential, parallel, loop, handoff
sage/contracts/ Contract IR, DAG verification, Z3 SMT, CEGAR repair
sage/memory/ 4-tier memory: working (Arrow), episodic (SQLite), semantic (graph), ExoCortex (RAG)
sage/llm/ LLM providers: Google Gemini, OpenAI Codex CLI, model router
sage/providers/ Provider discovery, capability matrix, OpenAI-compat adapter
sage/strategy/ AdaptiveRouter (4-stage learned routing: structural → kNN embeddings → BERT ONNX → entropy probe; stage 3 reserved), KnnRouter (arXiv 2505.12601, 92% accuracy on 50 GT tasks), ComplexityRouter (heuristic fallback), CGRS self-braking
sage/topology/ MAP-Elites + CMA-ME + MCTS topology search, LLM synthesis, KG-RLVR process reward model
sage/evolution/ Evolutionary engine, LLM-driven mutation
sage/tools/ Tool registry, dynamic tool creation (Rust ToolExecutor first, Python fallback), memory tools, ExoCortex tools
sage/events/ EventBus: in-proc event system for observability
sage/guardrails/ 3-layer guardrails: input, runtime, output
sage/bench/ EvalPlus HumanEval+/MBPP+, routing accuracy, routing quality, ablation, evaluation protocol with error logging
sage/sandbox/ Sandbox manager (host execution disabled by default)
sage/routing/ ShadowRouter (dual Rust/Python traces)

Environment Variables

export GOOGLE_API_KEY="..."              # Required for Gemini models
export SAGE_MODEL_FAST="gemini-2.5-flash"  # Override any tier model ID
export SAGE_DASHBOARD_TOKEN="..."        # Dashboard auth (optional)

Dependencies

Core: httpx, pydantic, rich, anyio, aiosqlite, numpy. Optional: google-genai (Gemini), openai (Codex), pyarrow (Arrow memory), z3-solver (formal verification), fastapi/uvicorn (dashboard), sentence-transformers (Tier 2 embeddings), onnxruntime (Tier 1 RustEmbedder DLL), sage_core with tool-executor feature (Rust ToolExecutor: tree-sitter validation + Wasm WASI sandbox + subprocess isolation).

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

ygn_sage-0.1.0.tar.gz (453.3 kB view details)

Uploaded Source

Built Distribution

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

ygn_sage-0.1.0-py3-none-any.whl (371.5 kB view details)

Uploaded Python 3

File details

Details for the file ygn_sage-0.1.0.tar.gz.

File metadata

  • Download URL: ygn_sage-0.1.0.tar.gz
  • Upload date:
  • Size: 453.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for ygn_sage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a4bdc192ce12f8bf053f1b31790fe81bcc1ce929dcf2d9a9b50811a594ccea97
MD5 44ae6aaac0cc743d62c3b1b9dfd3d86a
BLAKE2b-256 4aefa5b5f623af7138b332b13e937df21029b8f7a1a38b5399f693fcdfe973ca

See more details on using hashes here.

File details

Details for the file ygn_sage-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ygn_sage-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 371.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for ygn_sage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34bf738e4a895272b68ebd53ac84e05321a356e979426b142bcb332baca489b8
MD5 e40ab750a5eb0936e220c4bb068cac1a
BLAKE2b-256 a3f09b6ce5ef743914c70c31d8161093ed13aafff9ac649d3debb90060cbde67

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