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, neutral fields, versions
memory.json            # labeled memory records
secrets.json           # PII placeholders + secret requirements
skills/<slug>/SKILL.md # portable skill definitions (agentskills.io)
mcp.json               # MCP server configs (Claude Desktop format)
agent-card.json        # A2A agent card
AGENTS.md              # per-egg deployment runbook
apm.yml                # APM manifest (passthrough, if present)
specs/                 # embedded spec snapshots for self-sustained eggs
raw/...                # redacted source files (for passthrough mode hatch)

Agentic standards

Nydus integrates with five agentic standards. Each has a spec file in specs/, validation against its schema, and an extract CLI command:

Standard Spec source Egg artifact
MCP specs/mcp.md mcp.json
Agent Skills specs/agentskills.md skills/<slug>/SKILL.md
A2A specs/a2a.md agent-card.json
APM specs/apm.md apm.yml
AGENTS.md specs/agents.md AGENTS.md

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 (includes inline validation)
nydus inspect agent.egg
nydus inspect agent.egg --secrets --logs

# Extract standard artifacts
nydus extract mcp --from agent.egg -o ./out
nydus extract skills --from agent.egg -o ./out
nydus extract a2a --from agent.egg -o ./out
nydus extract apm --from agent.egg -o ./out
nydus extract agents --from agent.egg -o ./out
nydus extract specs --from agent.egg -o ./specs
nydus extract all --from agent.egg -o ./extracted

# 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, protocols (Spawner/Hatcher ABCs), errors
  agents/        # Per-platform spawners + hatchers (openclaw, zeroclaw, letta)
  engine/        # Core pipelines: spawn, hatch, save/load egg, diff, merge, refine, validate
  standards/     # Per-standard modules: mcp, skills, a2a, apm, agents_md (validate/extract/generate)
  security/      # Presidio, gitleaks, Ed25519 signing
  cmd/           # Typer CLI (spawn, hatch, inspect, extract, diff, env, keygen, push/pull)
  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)
specs/           # Spec files with embedded JSON Schema (mcp, agentskills, a2a, apm, agents)
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        # Ruff format check + lint (no writes)

Docstring and comment conventions are documented in docs/contributing/code-style.md. CI runs Ruff; see docs/guides/code-quality.md.

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.7.tar.gz (87.4 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.7-py3-none-any.whl (119.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pynydus-0.0.7.tar.gz
  • Upload date:
  • Size: 87.4 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.7.tar.gz
Algorithm Hash digest
SHA256 58727c25392fe1bd82ed66ef0e0697abad1b76fbabb90aaf950f6f7422d4eb91
MD5 4454bb8681265f57aec3c382539ef8de
BLAKE2b-256 c50a19020e7d26de0120b195601b61a9ad3f6e92e02f518509c41e3c874e5bb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynydus-0.0.7.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.7-py3-none-any.whl.

File metadata

  • Download URL: pynydus-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 119.0 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 86bdc62b14f95073a78f2688026aa053a539907e313f422b9361c6b92b75e048
MD5 2dd22405b49d84662beb73be1d043b87
BLAKE2b-256 1d47fdafb32238bac70e0b677fc24d373439fedbb2e0f4de66ef074dd511418f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynydus-0.0.7-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