pynydus.standards.agents_md

AGENTS.md standard: validate, extract, generate.

Generates a per-egg deployment runbook from egg data.

Module Contents

Functions

validate

Validate the egg’s per-egg AGENTS.md structural completeness.

_parse_sections

Check which required sections are present in the markdown.

extract

Extract the per-egg AGENTS.md from the egg.

generate

Generate a per-egg AGENTS.md deployment runbook.

_build_template

Build a deployment runbook from egg data using a deterministic template.

API

pynydus.standards.agents_md.validate(egg: pynydus.api.schemas.Egg, schema: dict[str, Any] | None = None) list[pynydus.api.schemas.ValidationIssue]

Validate the egg’s per-egg AGENTS.md structural completeness.

Checks that required sections (Prerequisites, Hatch) are present, and that optional sections exist when the egg has relevant data.

Args: egg: The Egg to validate. schema: Optional JSON Schema dict. When None, the schema is loaded from the bundled agents spec.

Returns: List of validation issues (empty if valid or if agents_md is absent).

pynydus.standards.agents_md._parse_sections(text: str) dict[str, Any]

Check which required sections are present in the markdown.

pynydus.standards.agents_md.extract(egg: pynydus.api.schemas.Egg) dict[str, str]

Extract the per-egg AGENTS.md from the egg.

Args: egg: The Egg that may contain passthrough AGENTS.md content.

Returns: {"AGENTS.md": <content>} or empty dict if absent.

pynydus.standards.agents_md.generate(egg: pynydus.api.schemas.Egg, *, llm_fn: Any = None) dict[str, str]

Generate a per-egg AGENTS.md deployment runbook.

If the egg already has one, returns it unchanged. Otherwise builds one from a template, with optional LLM polish.

Args: egg: Source egg. llm_fn: Optional callable (draft: str) -> str that polishes the template output via LLM. When None, the template is returned as-is.

Returns: {"AGENTS.md": <content>}.

pynydus.standards.agents_md._build_template(egg: pynydus.api.schemas.Egg) str

Build a deployment runbook from egg data using a deterministic template.