uks-sdk (Python)
Python SDK for building and validating Universal Knowledge & Action Schema (UKS) v3.0 packets.
pip install uks-sdk
Usage
Validate a packet
from uks_sdk import validate, validate_file
# From a dict
result = validate(packet_dict)
print(result.valid, result.inferred_level, result.level_match)
if not result.valid:
for err in result.errors:
print(err)
# From a file
result = validate_file("my-packet.uks.json")
Build a packet with Pydantic models
from uks_sdk import UKSPacket, Source, Topic
packet = UKSPacket(
packet_id="uks-omega3-v1",
schema_version="3.0",
conformance_level="L1",
created_at="2026-06-16T00:00:00Z",
topic=Topic(title="Omega-3 Fatty Acids"), # topic is an object, not a bare string
sources=[
Source(
id="src_001",
title="Effect of EPA and DHA on cardiovascular risk",
source_type="research_paper",
credibility_score=9,
evidence_grade="high",
clinical_status="validated",
doi="10.1000/example",
license_label="CC BY 4.0",
rights_url="https://creativecommons.org/licenses/by/4.0/",
)
],
)
import json
# by_alias=True so `_extensions` (not `extensions`) is emitted
print(json.dumps(packet.model_dump(by_alias=True, exclude_none=True), indent=2))
Validate a built packet
result = validate(packet.model_dump(by_alias=True, exclude_none=True))
assert result.valid
Types
All UKS v3.0 types are available as Pydantic v2 models:
| Model | Description |
|---|---|
UKSPacket |
Root packet object |
Source |
Research source |
DataContract |
Layer A contract |
ScrapeTarget |
Layer B acquisition target |
ExtractionRule |
Layer C parsing rule |
Directive |
Layer D processing rule |
Action |
Layer E action |
ActionStep |
Individual action step |
AgentInstructions |
Agent behavior configuration |
KnowledgeNode |
Entity in the knowledge graph |
Evidence Grades
from uks_sdk import EvidenceGrade
EvidenceGrade.HIGH # "high" — meta-analyses of RCTs
EvidenceGrade.MODERATE # "moderate" — individual RCTs
EvidenceGrade.LOW # "low" — observational studies
EvidenceGrade.VERY_LOW # "very_low" — expert opinion
EvidenceGrade.NA # "n_a" — datasets, non-clinical
Requirements
- Python 3.10+
- pydantic >= 2.7
- jsonschema >= 4.22
Links
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
uks_sdk-1.1.0.tar.gz
(22.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
uks_sdk-1.1.0-py3-none-any.whl
(20.2 kB
view details)
File details
Details for the file uks_sdk-1.1.0.tar.gz.
File metadata
- Download URL: uks_sdk-1.1.0.tar.gz
- Upload date:
- Size: 22.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
770f780ccce1577de2438139598cf84e00c65f28541fd58dd0e57239b3687dcf
|
|
| MD5 |
350f06afcc75fd0300883c7c3c6f6199
|
|
| BLAKE2b-256 |
ea49528ad4f3ef296640317e322a3ad8725ff16ba30eb55cdd65edf8cdd6b998
|
File details
Details for the file uks_sdk-1.1.0-py3-none-any.whl.
File metadata
- Download URL: uks_sdk-1.1.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e589ea7c2db269e0fd93c40ca2bab4b4a6815e3f56ac8ba5720fa6f04f423ea1
|
|
| MD5 |
f94c67167ef5857b99342b6a53ef21bf
|
|
| BLAKE2b-256 |
b182b3a62cc640a7f6a05f7985f6d0f41a86b453e4563f125d6c6b718fd4c6dd
|