pynydus.client.client¶
Python SDK: mirrors the CLI 1:1. Spec §19.
Usage::
from pynydus import Nydus
ny = Nydus()
egg = ny.spawn() # reads ./Nydusfile
egg = ny.spawn(nydusfile="path/to/Nydusfile")
path = ny.save(egg, Path("agent.egg"))
egg = ny.load(Path("agent.egg"))
egg.skills.skills # list of AgentSkill
egg.memory.memory # list of MemoryRecord
egg.inspect_secrets()
result = ny.hatch(egg, target=AgentType.LETTA)
Module Contents¶
Classes¶
Main SDK entry point (mirrors CLI behavior). |
API¶
- class pynydus.client.client.Nydus¶
Main SDK entry point (mirrors CLI behavior).
Initialization
Load LLM and registry settings from environment variables.
Set
NYDUS_LLM_TYPEandNYDUS_LLM_API_KEYfor refinement. SetNYDUS_REGISTRY_URL(and optionallyNYDUS_REGISTRY_AUTHOR) for registry operations. See :mod:pynydus.config.- spawn(nydusfile: pathlib.Path | str | None = None) pynydus.api.schemas.Egg¶
Spawn an Egg from a Nydusfile.
Args: nydusfile: Path to a Nydusfile. If
None, resolves one in the current working directory.Returns:
Eggwithraw_artifactsandspawn_logpopulated from the pipeline. Use :meth:saveto write a.eggfile.
- hatch(egg: pynydus.api.schemas.Egg, *, target: pynydus.common.enums.AgentType, output_dir: pathlib.Path | None = None, secrets: str | pathlib.Path | None = None, mode: pynydus.common.enums.HatchMode = HatchMode.REBUILD, spawn_log: list[dict] | None = None, raw_artifacts: dict[str, str] | None = None) pynydus.api.schemas.HatchResult¶
Hatch an Egg into a target runtime.
Args: egg: Loaded Egg to render. target: Destination platform. output_dir: Directory for output files (connector default if omitted). secrets: Path to
.envfor placeholder substitution. mode:rebuild(structured modules) orpassthrough(raw snapshot). spawn_log: Spawn pipeline log for the hatch LLM. defaults toegg.spawn_log. raw_artifacts: Redactedraw/snapshot. defaults toegg.raw_artifacts. required forpassthroughwhen empty on the egg.Returns:
HatchResultwith paths and written files.
- save(egg: pynydus.api.schemas.Egg, output: pathlib.Path, *, raw_artifacts: dict[str, str] | None = None, spawn_log: list[dict] | None = None, nydusfile_text: str | None = None, sign: bool = False) pathlib.Path¶
Write an Egg to a
.eggarchive.Args: egg: The Egg to save. output: Destination file path (gets
.eggsuffix). raw_artifacts: Overrideegg.raw_artifactsfor the archive. spawn_log: Overrideegg.spawn_logfor the archive. nydusfile_text: Embed Nydusfile text in the archive. sign: IfTrue, sign with the user’s Ed25519 private key.Returns: Path to the written
.eggfile.
- load(egg_path: pathlib.Path, *, include_raw: bool = True) pynydus.api.schemas.Egg¶
Load a
.eggarchive into a fully populated :class:~pynydus.api.schemas.Egg.Args: egg_path: Path to the
.eggfile. include_raw: IfFalse,raw/is not read intoegg.raw_artifacts(empty dict). Use for large eggs when only structured modules are needed. for passthrough hatch, load withinclude_raw=Trueor passread_raw_artifacts(egg_path)to :meth:hatch.Returns: Fully populated Egg with spawn_log, raw_artifacts, and nydusfile.
- validate(egg: pynydus.api.schemas.Egg) pynydus.api.schemas.ValidationReport¶
Validate structural integrity of an Egg.
Args: egg: Egg to check.
Returns: Report with errors and warnings.
- diff(egg_a: pynydus.api.schemas.Egg, egg_b: pynydus.api.schemas.Egg) pynydus.api.schemas.DiffReport¶
Compare two Eggs.
Args: egg_a: First Egg. egg_b: Second Egg.
Returns: Structured diff report.
- push(egg_path: pathlib.Path, *, name: str, version: str | None = None, author: str | None = None) dict¶
Push a packed
.eggto the Nest registry.Args: egg_path: Packed archive path. name: Registry name (e.g.
user/my-agent). version: Semver. ifNone, taken fromegg.manifest.egg_version. author: Optional author override.Returns: Server JSON response body.
- pull(name: str, *, version: str = 'latest', output: pathlib.Path = Path('pulled.egg')) pathlib.Path¶
Pull an Egg from the Nest registry.
Args: name: Registry name (e.g.
user/my-agent). version: Semver tag. defaultlatest. output: Destination path for the downloaded.egg.Returns: Path written on disk.
- list_versions(name: str) list[dict]¶
List published versions for name.
Args: name: Registry-qualified egg name.
Returns: List of version metadata dicts from the server.
- _get_registry_client()¶
Build a
NestClientfromNYDUS_REGISTRY_URL.