logic-md
A Python SDK for parsing and validating LOGIC.md specifications — declarative reasoning configurations for AI agents.
Status: Alpha — parser and validator only.
Installation
pip install logic-md
Quick Start
from logic_md import parse, validate
# Parse a LOGIC.md file
with open("my-agent.logic.md") as f:
content = f.read()
result = parse(content)
if result.ok:
print(f"Parsed spec: {result.data['name']}")
else:
print(f"Parse errors: {result.errors}")
# Validate the parsed spec
val_result = validate(result.data)
if val_result.ok:
print("Spec is valid!")
else:
for error in val_result.errors:
print(f"Validation error at {error['path']}: {error['message']}")
API
parse(content: str) -> ParseResult
Extracts YAML frontmatter from a LOGIC.md file and returns a ParseResult:
ok: bool— True if parsing succeededdata: dict— Parsed YAML frontmatter (if ok=True)content: str— Markdown body after frontmattererrors: list[str]— Error messages (if ok=False)
Example:
result = parse("---\nspec_version: '1.0'\nname: my-agent\n---\n# My Agent")
# result.ok = True
# result.data = {"spec_version": "1.0", "name": "my-agent"}
# result.content = "# My Agent"
validate(spec: dict) -> ValidationResult
Validates a parsed spec against the LOGIC.md JSON Schema and returns a ValidationResult:
ok: bool— True if spec is validdata: dict— The validated spec (if ok=True)errors: list[dict]— Validation errors withpath,keyword,message(if ok=False)
Example:
result = validate({"spec_version": "1.0", "name": "my-agent"})
# result.ok = True
# result.data = {"spec_version": "1.0", "name": "my-agent"}
LogicSpec
A TypedDict type hint for the parsed/validated spec structure. Use for type hints:
from logic_md import LogicSpec
def process_spec(spec: LogicSpec) -> None:
print(spec["name"])
Schema
The validator uses the canonical JSON Schema from the logic-md spec repository.
Links
Metadata
Release files for logic-md 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| logic_md-0.1.1.tar.gz | 13.8 kB | Without provenance | Details for logic_md-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| logic_md-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for logic_md-0.1.1-py3-none-any.whl |
Total release size: 24.9 kB
Release files / logic_md-0.1.1.tar.gz
| Download URL | logic_md-0.1.1.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9206beb4f9e3f183190fa9226f322c9a6cb7ce2e2cd4e9b0d7e837e7886f9717
|
|
BLAKE2b-256 checksum How to use checksums |
283b62b5e7bbba8ade2d09234cd68b77bdd8951a489b5fdf61709233de0855f7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / logic_md-0.1.1-py3-none-any.whl
| Download URL | logic_md-0.1.1-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a843c4bffd4685bc861f99592710420a5ab17afb9cdaf2c3ca52aec15f2841d
|
|
BLAKE2b-256 checksum How to use checksums |
dd25f8d09dfe9ba30c3b0838ebdc6fceb5aa813c4a60295e32363ff2239ff4dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for logic-md 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.