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, comment, and lint conventions are documented in docs/guides/code-style.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.8.tar.gz (86.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.8-py3-none-any.whl (113.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pynydus-0.0.8.tar.gz
  • Upload date:
  • Size: 86.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.8.tar.gz
Algorithm Hash digest
SHA256 c7b39ea51d29bdfcf151eb04c6536a6dbc235dbce1c0d95994a7879a6da40552
MD5 0df6d09db96a8dffa7c39687742e7278
BLAKE2b-256 c846a9fdb64e91a421855f9371b4d612eba06410b23c2f51e43e0723a253cd51

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pynydus-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 113.7 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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 92bc9b940101375dfb946003372f404de3be8ba399cf623f9c48f0c8ec3e7c7a
MD5 2c800953caecd851d4c536da37a06398
BLAKE2b-256 55dffeea89710fc7dcd3db717fe78b0e78a4b66e4b99478b2c70b290ab2a4513

See more details on using hashes here.

Provenance

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