Skip to main content

NEPHIS Python SDK (nephis / thanaton)

Official Python SDK for the NEPHIS Systems Fabric & Sovereign Substrates.
Sub-6ms Hardware-Isolated MicroVM Sandboxes, 30ms Zero-Copy PostgreSQL Branching, and Sub-38ms Bare-Metal Code Execution for Autonomous AI Agents.

Python Version License Zero Dependencies PyPI version


⚡ Architecture & Substrates

  • Canonical Gateway: https://nephis.theeducode.com
  • Zero Human Signup: curl -s -X POST https://nephis.theeducode.com/v1/claim (500 free execution credits granted instantly)
  • Zero Third-Party Dependencies: Built on pure Python standard library (urllib.request, json, os, sys). Zero bloat, zero dependency conflicts.
┌────────────────────────────────────────────────────────┐
│ Autonomous AI Coding Agent / Python Application        │
└───────────────────────────┬────────────────────────────┘
                            │ Python SDK (REST / Unix Socket)
                            ▼
┌────────────────────────────────────────────────────────┐
│ NEPHIS Gateway (https://nephis.theeducode.com)         │
└───────┬───────────────────┬───────────────────┬────────┘
        │                   │                   │
        ▼                   ▼                   ▼
┌──────────────┐    ┌──────────────┐    ┌──────────────┐
│   THANATON   │    │  MNEMON-DB   │    │   ESCHATON   │
│ KVM MicroVMs │    │  Zero-Copy   │    │ Sub-38ms AST │
│ 4.82ms Boot  │    │  PostgreSQL  │    │ Polyglot CI  │
└──────────────┘    └──────────────┘    └──────────────┘

📦 Installation

pip install nephis

Or install locally from source:

git clone https://github.com/mohitrajdeo/testing-judge0-vm.git
cd testing-judge0-vm/sdk/python
pip install -e .

🚀 Quickstart

1. Unified Master Client (Nephis)

from nephis import Nephis

# Initialize with API key (or set NEPHIS_API_KEY environment variable)
client = Nephis(api_key="mrd_live_YOUR_KEY", base_url="https://nephis.theeducode.com")

# 1. Evaluate code in sub-38ms across 50 testcases with AST preflight protection
run = client.execute(
    language="python",
    code="print(sum(i for i in range(1000000)))"
)
print(run.stdout)          # "499999500000"
print(f"Latency: {run.duration_ms}ms")  # 38.2ms

# 2. Boot a hardware-isolated Linux MicroVM sandbox in 4.82ms
sandbox = client.sandboxes.create(memory_mb=256, runtime="microvm")
res = sandbox.exec("uname -a && cat /etc/os-release")
print(res.stdout)
sandbox.destroy()

# 3. Branch an ephemeral PostgreSQL 16 database in 30ms (0 bytes initial storage)
branch = client.db.branch(parent="main", name="agent-migration-preview")
rows = branch.query("SELECT 1 AS status, NOW() AS ts;")
print(rows)
branch.destroy()

2. MicroVM Sandbox Management (thanaton.Client)

import thanaton

client = thanaton.Client(
    base_url="https://nephis.theeducode.com",
    api_key="mrd_live_YOUR_KEY"
)

# 1. Ephemeral standalone code run (microVM auto-destroyed after execution)
result = client.run_code(
    code="import math; print(math.sqrt(1764))",
    language="python"
)
print(result.stdout)       # "42.0"
print(f"Execution time: {result.duration_ms}ms")

# 2. Context manager with embedded PostgreSQL 16
with client.sandboxes.create(runtime="microvm", memory_mb=512, with_db=True) as sbx:
    print(f"Spawned MicroVM: {sbx.id} (Booted in {sbx.boot_duration_ms:.2f}ms)")
    print(f"Embedded Postgres URL: {sbx.db_url}")

    # Run bash commands with full root capabilities
    out = sbx.exec("pip install -q requests")
    print(out.stdout)

    # Run queries directly against the bundled database
    sbx.sql("CREATE TABLE users (id SERIAL PRIMARY KEY, name TEXT);")
    sbx.sql("INSERT INTO users (name) VALUES ('Alice'), ('Bob');")
    data = sbx.sql("SELECT * FROM users;")
    print("Database Rows:", data)

    # Scale to zero stasis: hibernates RAM to NVMe (0% CPU, $0 idle RAM cost)
    sbx.sleep()
    print("State:", sbx.state)  # "sleeping"

    # Instant wake (<6ms)
    sbx.wake()
    print("State:", sbx.state)  # "running"

3. Serverless PostgreSQL 16 Zero-Copy Branching (MnemonClient)

from nephis import MnemonClient

client = MnemonClient(
    api_url="https://nephis.theeducode.com",
    api_key="mrd_live_YOUR_KEY"
)

# 1. Fork production database in 30ms via XFS reflink CoW (0 bytes initial storage)
branch = client.branch_database(
    tenant_id="org_prod",
    new_branch="experiment_v2",
    parent_branch="main"
)
print("Branch DB Connection String:", branch["connection_string"])

# 2. Run DDL schema changes or queries
client.execute_sql(
    tenant_id="org_prod",
    branch="experiment_v2",
    sql="ALTER TABLE users ADD COLUMN embedding vector(3);"
)

# 3. Inspect schema diff between branch and main
diff = client.schema_diff("org_prod", "experiment_v2")
print("Migration DDL:", diff.get("migration_ddl"))

# 4. Instant rollback (<50ms) back to parent state
client.reset_branch("org_prod", "experiment_v2")

# 5. Point-in-Time Recovery (PITR) to exact historical timestamp
pitr = client.time_travel(
    tenant_id="org_prod",
    new_branch="audit_snapshot",
    target_time="2026-11-15T10:00:00Z"
)
print("PITR DB URL:", pitr["connection_string"])

🤖 AI Agent Framework Integrations

CrewAI

from crewai.tools import tool
from nephis import Nephis

client = Nephis(api_key="mrd_live_YOUR_KEY")

@tool("Nephis Hardware Code Executor")
def execute_untrusted_code(code: str, language: str = "python") -> str:
    """Execute untrusted code safely in sub-38ms with AST preflight sanitization."""
    result = client.execute(language=language, code=code)
    if result.exit_code == 0:
        return result.stdout
    return f"Execution Error (Exit {result.exit_code}):\n{result.stderr}"

LangChain

from langchain_core.tools import tool
from nephis import Nephis

client = Nephis(api_key="mrd_live_YOUR_KEY")

@tool
def nephis_code_sandbox(code: str) -> str:
    """Runs code in an isolated bare-metal microVM with zero host infection risk."""
    res = client.execute(language="python", code=code)
    return res.stdout or res.stderr

⚙️ Environment Variables

Variable Description Default
NEPHIS_API_KEY Unified API Bearer Token "" (Use POST /v1/claim for 500 free credits)
NEPHIS_BASE_URL Canonical Production Gateway https://nephis.theeducode.com
THANATON_API_URL Thanaton MicroVM Engine URL https://nephis.theeducode.com
MNEMON_MGMT_URL Mnemon-DB Management Endpoint https://nephis.theeducode.com

👤 Creator & Engineering Attribution

Metadata

Release files for nephis 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nephis 1.0.1
File Size Uploaded Provenance Actions
nephis-1.0.1.tar.gz 130.5 kB Without provenance Details for nephis-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nephis 1.0.1
File Interpreter ABI Platform Actions
nephis-1.0.1-py3-none-any.whl Python 3 none any Details for nephis-1.0.1-py3-none-any.whl

Total release size: 271.1 kB

Release files / nephis-1.0.1.tar.gz

Download URL nephis-1.0.1.tar.gz
Size 130.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4329b92f49a6b8a74edd45cdf9838391df79c661118744ddd20a44c62ab86586
BLAKE2b-256 checksum
How to use checksums
42b72aa849cf5700ea88899cc134c9d6ec6e7ceb687a036bc8349611420c9124
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Release files / nephis-1.0.1-py3-none-any.whl

Download URL nephis-1.0.1-py3-none-any.whl
Size 140.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fca104f7135457ff88f97d65b6ef8426f88de13537a3c5d31bb253ab338b519a
BLAKE2b-256 checksum
How to use checksums
508e563df96ff9a9057a90b37fb70f991ef62bfb737430c549759aa2ca59d200
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.1

Security for nephis 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page