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
Metadata
Release files for uks-sdk 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| uks_sdk-1.1.0.tar.gz | 22.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| uks_sdk-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.7 kB
Release files / uks_sdk-1.1.0.tar.gz
| Download URL | uks_sdk-1.1.0.tar.gz |
|---|---|
| Size | 22.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
770f780ccce1577de2438139598cf84e00c65f28541fd58dd0e57239b3687dcf
|
|
BLAKE2b-256 checksum How to use checksums |
ea49528ad4f3ef296640317e322a3ad8725ff16ba30eb55cdd65edf8cdd6b998
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Release files / uks_sdk-1.1.0-py3-none-any.whl
| Download URL | uks_sdk-1.1.0-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e589ea7c2db269e0fd93c40ca2bab4b4a6815e3f56ac8ba5720fa6f04f423ea1
|
|
BLAKE2b-256 checksum How to use checksums |
b182b3a62cc640a7f6a05f7985f6d0f41a86b453e4563f125d6c6b718fd4c6dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|