Skip to main content

Portable state transport for AI agents

Project description

Nydus

Portable state transport for AI agents
Transport agent state between any two frameworks without manual migration

PyPI Python License Docs Status

DocsInstallHow it worksCLIPython SDKDevelopment


How it works

  • Spawn: read source agent artifacts, redact PII, and package everything into a portable Egg (.egg archive)
  • Hatch: decode an Egg into any supported target runtime, with optional LLM refinement and secret injection
Source artifacts → Spawn → Egg (.egg) → Hatch → Target-native files

The Egg format

An .egg file is a signed ZIP archive containing:

manifest.json          # metadata, source type, versions
memory.json            # labeled memory records
secrets.json           # PII placeholders + secret requirements
skills/<slug>/SKILL.md # portable skill definitions (agentskills.io)
mcp/<server>.json      # MCP server configs
raw/...                # redacted source files (for passthrough mode hatch)

Install

pip install pynydus

Prerequisites

Gitleaks is required for spawning when REDACT true (the default) and SOURCE directives are present. Gitleaks scans source files for secrets (API keys, tokens, passwords). Install it before running nydus spawn:

# macOS
brew install gitleaks

# Linux (download from GitHub releases)
curl -sSL https://github.com/gitleaks/gitleaks/releases/latest/download/gitleaks_8.21.2_linux_x64.tar.gz \
  | tar xz -C /usr/local/bin gitleaks

# Or build from source (requires Go 1.22+)
go install github.com/gitleaks/gitleaks/v8@latest

If gitleaks is installed in a non-standard location, set NYDUS_GITLEAKS_PATH:

export NYDUS_GITLEAKS_PATH=/opt/bin/gitleaks

Hatching (and FROM-only spawns without SOURCE) does not require gitleaks.

CLI

# Create a Nydusfile in your project directory
cat > Nydusfile << 'EOF'
SOURCE openclaw ./my-agent/
REDACT true
EOF

# Spawn an egg
nydus spawn -o agent.egg

# Inspect and validate
nydus inspect agent.egg
nydus inspect agent.egg --secrets --logs
nydus validate agent.egg

# Generate a template .env from the egg's secret requirements
nydus env agent.egg -o agent.env

# Hatch into a target runtime
nydus hatch agent.egg --target letta --secrets agent.env

# Compare two eggs
nydus diff v1.egg v2.egg

# Signing
nydus keygen
nydus spawn -o signed.egg  # auto-signs if key exists

Python SDK

from pathlib import Path

from pynydus import Nydus
from pynydus.common.enums import AgentType

ny = Nydus()

# Spawn from a Nydusfile in the current directory
egg = ny.spawn()
ny.save(egg, Path("agent.egg"))

# Load and hatch into a target runtime
egg = ny.load(Path("agent.egg"))
result = ny.hatch(egg, target=AgentType.LETTA, secrets="agent.env")
print(result.output_dir, result.files_created)

Project structure

pynydus/
  api/           # Egg data model, schemas, errors
  agents/        # Per-platform spawners + hatchers (openclaw, zeroclaw, letta)
  engine/        # Core pipelines: spawn, hatch, save/load egg, validate, diff, merge, refine
  security/      # Presidio, gitleaks, Ed25519 signing
  cmd/           # Typer CLI
  client/        # Python SDK (Nydus class)
  common/        # Shared enums, connector helpers, scan_paths
  llm/           # LLM tier models and Instructor client
  config.py      # Environment-based config loader
  remote/        # Nest registry client
  eggs/base/     # Base egg source definitions (Nydusfile + agent files per version)
tests/
  unit/          # Unit tests (mocked dependencies)
  integration/   # Integration tests (full pipeline, requires gitleaks)

Configuration

Set environment variables for LLM refinement and the Nest registry. Copy [.env.example](.env.example) to .env and fill in your values. See the Configuration doc for all available settings (NYDUS_LLM_TYPE, NYDUS_LLM_API_KEY, NYDUS_REGISTRY_URL, etc.).

Development

uv sync --group dev

Tests

Tests are split into tests/unit/ and tests/integration/ with dedicated Make targets:

make test-unit          # fast, no external deps
make test-integration   # full pipeline, requires gitleaks
make test               # both (excludes live LLM)
make test-live-llm      # requires .env with NYDUS_LLM_TYPE + NYDUS_LLM_API_KEY

Integration tests require gitleaks on PATH (see Prerequisites).

For live LLM tests, copy .env.example to .env and fill in your API key. The .env file is loaded automatically by pytest-dotenv.

Code style

make fmt          # Ruff formatter + auto-fix lint
make check        # CI-style check (no writes)

Documentation

Full documentation is hosted at pynydus.readthedocs.io.

See CONTRIBUTING.md for the full development guide.

Status

Early development. APIs and on-disk formats may change between releases.

License

MIT

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

pynydus-0.0.6.tar.gz (77.7 kB view details)

Uploaded Source

Built Distribution

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

pynydus-0.0.6-py3-none-any.whl (106.3 kB view details)

Uploaded Python 3

File details

Details for the file pynydus-0.0.6.tar.gz.

File metadata

  • Download URL: pynydus-0.0.6.tar.gz
  • Upload date:
  • Size: 77.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pynydus-0.0.6.tar.gz
Algorithm Hash digest
SHA256 b2665cdd9ce4b2a35b9394d877dac50e49ca7bcb51abb677a88b401978cd9e9d
MD5 f4513685a940c88a176176b544d276d1
BLAKE2b-256 ef40d0a63f10f1229185b0a481404af997cbcc168f5b4c21ed9490336177b408

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynydus-0.0.6.tar.gz:

Publisher: workflow.yml on NydusAI/nydus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pynydus-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: pynydus-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 106.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pynydus-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c80da361a90704526ceea094d768d57e4ae19af1475ad40fa5883239a9c75c66
MD5 9a2481661bda10a797235b6d327901bc
BLAKE2b-256 1e381c17087a6e36c4ffb7a81d87f75267fef3f431ee79104ac886d7147ff783

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynydus-0.0.6-py3-none-any.whl:

Publisher: workflow.yml on NydusAI/nydus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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