artemis-provenance-sdk
Thin Python client for the Artemis Provenance data plane — mark and verify AI-generated media (image · video · audio) for EU AI Act Article 50(2) compliance. The SDK contains no marking logic; it serializes calls to the data-plane container the customer runs in their own network, so content never leaves the VPC.
pip install artemis-provenance-sdk
Usage
from artemis_provenance_sdk import Client, MarkingFailedError, MarkingUnavailableError
pv = Client(endpoint="http://provenance-dp.internal:8080", api_key="...")
# Mark an asset at the end of your generation pipeline.
try:
marked = pv.mark_image(image_bytes, app_id="avatar-studio",
context={"title": "Generated avatar"})
# marked.bytes -> the marked output to ship
# marked.event_id, marked.payload_id, marked.sha256, marked.marks
except MarkingFailedError as err:
# The data plane ran and could NOT produce the required mark.
# err.required_mark, err.event_id, err.reason
# err.unmarked is the unmarked output — not None only if your tenant
# policy is `return_unmarked`. Shipping it is a compliance gap.
...
except MarkingUnavailableError:
# Decide fail-open (ship unmarked — a compliance gap) vs fail-closed.
...
# Verify locally — content never leaves your network; only the id is resolved.
result = pv.verify(image_bytes, content_type="image")
# result["result"] == "matched" | "no-match", result["event"], result["checks"], result["local"]
There is also a file convenience wrapper:
marked = pv.mark_image_file("out/hero.png", app_id="avatar-studio")
Text — attested, not watermarked
There is no robust post-hoc text watermark: statistical watermarks exist only
at generation time, and invisible-Unicode marks are strippable by design.
mark_text therefore attests text — canonical hashes plus a detached,
KMS-signed manifest recorded on your provenance chain — with an optional,
explicitly strippable zero-width soft binding.
attested = pv.mark_text(article_text, app_id="newsroom",
context={"title": "Q3 results", "model": "my-llm"})
# attested.text -> the text to publish (identical unless soft_binding=True)
# attested.manifest_jws -> detached signed manifest (portable proof)
# attested.text_canonical_hash, attested.event_id, attested.payload_id
result = pv.verify_text(some_text)
# result["verdict"] -> "exact-match" | "canonical-match" | "softbinding-recovered" | "no-match"
The optional soft binding (soft_binding=True) only makes the record
auto-discoverable in byte-preserving copy flows — it is best-effort and removed
by normalization, sanitizers, retyping, or one free paste-through tool. A
no-match verdict proves nothing about origin: unmarked, edited,
paraphrased, translated, or third-party text all produce it, and no
AI-vs-human inference is ever made.
Declaring AI generation
The signed manifest declares the content AI-generated by default: this SDK
sits in your generation pipeline, and the AI disclosure is the obligation it
exists to discharge. ai_generated (on mark_text and mark_image) sets the
C2PA/IPTC digital_source_type:
pv.mark_text(draft, app_id="newsroom") # trainedAlgorithmicMedia (default)
pv.mark_text(draft, app_id="newsroom", ai_generated=True) # trainedAlgorithmicMedia
pv.mark_text(draft, app_id="newsroom", ai_generated=False) # digitalCreation
Pass ai_generated=False to mark human-made, non-generative content — that is
the only way to get digitalCreation. The declaration is yours to make:
nothing detects AI generation, and the manifest is signed with your key. A
malformed value is rejected (HTTP 400); it never falls back to the default.
There is also a file convenience wrapper:
pv.mark_text_file("post.md", app_id="newsroom").
Fail modes
Marking has exactly two failure modes, and they are the same compliance outcome: nothing was marked. So they reach you the same way — raised, never returned. Both are catchable so your pipeline chooses fail-open vs fail-closed consciously; document the compliance implications of each.
| Exception | Means | HTTP |
|---|---|---|
MarkingUnavailableError |
The data plane is unreachable, or could not accept the request (e.g. payload ids exhausted). | connect error / 503 |
MarkingFailedError (a subclass of the above) |
The data plane ran and could not produce the required mark. | 422 with {"code": "marking_failed", ...} |
MarkingFailedError subclasses MarkingUnavailableError on purpose: if your
pipeline already handles an unreachable data plane, it handles a failed mark
identically with no code change. Catch MarkingFailedError first when you want
the detail.
The required mark is modality-aware
- image · video · audio — the invisible watermark. A C2PA manifest is metadata (strippable) and is never the required mark, so a manifest that fails on a correctly watermarked asset does not raise.
- text — the detached signed manifest. Text is attested, not watermarked; the optional zero-width soft binding is best-effort and its failure never raises.
try:
marked = pv.mark_image(image_bytes, app_id="avatar-studio")
publish(marked.bytes)
except MarkingFailedError as err:
err.required_mark # "watermark" | "signed-manifest"
err.event_id # the evidence event recording the failure
err.reason # e.g. "ValueError: no video frames decoded"
err.on_marking_failure # "reject" | "return_unmarked"
err.unmarked # see below — None under `reject`
raise # fail closed: publish nothing
Tenant policy: on_marking_failure
Set on your provenance policy (rules.onMarkingFailure), it decides what the
data plane does when the required mark fails.
reject(default) — fail closed. The data plane records the failure on your evidence chain, returns HTTP 422marking_failed, and returns no asset.err.unmarkedisNone, because nothing exists to ship.return_unmarked— availability over compliance. The data plane returns the unmarked output, flagged (markingFailed: true, amarkingFailureblock, and thex-provenance-marking-failedheader). The SDK still raises: the unmarked output is reachable only aserr.unmarked, so publishing it is always a deliberate act. Your regulator report names this choice, so an auditor sees it was yours and deliberate.
There is no configuration in which unmarked output is returned to your code as a successful result.
Typing
The package ships a py.typed marker; Client, MarkedAsset, MarkedText,
MarkingFailedError, VerifyResult and VerifyTextResult are fully typed for
editor/mypy support.
Releasing (maintainers)
See SETUP.md for the one-time PyPI Trusted Publishing setup and the per-release flow.
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
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
File details
Details for the file artemis_provenance_sdk-0.2.0.tar.gz.
File metadata
- Download URL: artemis_provenance_sdk-0.2.0.tar.gz
- Upload date:
- Size: 16.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1adf1fd693c9661569202f9aefcb5ba1dc79cd1b5cd46f7722479fbd9d5967ad
|
|
| MD5 |
cb9baec4e1d5a9da918ff26982c30bd2
|
|
| BLAKE2b-256 |
e5856fcbff17b01bb107c28b4d8aa17f9b5eff92c31bfe5590e15896abdf641c
|
Provenance
The following attestation bundles were made for artemis_provenance_sdk-0.2.0.tar.gz:
Publisher:
publish.yml on Star-48/artemis-provenance-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
artemis_provenance_sdk-0.2.0.tar.gz -
Subject digest:
1adf1fd693c9661569202f9aefcb5ba1dc79cd1b5cd46f7722479fbd9d5967ad - Sigstore transparency entry: 2758763302
- Sigstore integration time:
-
Permalink:
Star-48/artemis-provenance-sdk-python@450486a49efaee450d73b0d6dde3b7424cf1b1ee -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Star-48
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@450486a49efaee450d73b0d6dde3b7424cf1b1ee -
Trigger Event:
push
-
Statement type:
File details
Details for the file artemis_provenance_sdk-0.2.0-py3-none-any.whl.
File metadata
- Download URL: artemis_provenance_sdk-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d4ce3fb1a3e321bf3f0f0c4d27bd900a427f77465eed9ce9521d8503a500b1e
|
|
| MD5 |
7f3400b2cb440c78136cf0d6bf730bdf
|
|
| BLAKE2b-256 |
fda31f27279551c96fc55534280afa6bd3c3c2b7511b4b84e9dd0e7a1e49439a
|
Provenance
The following attestation bundles were made for artemis_provenance_sdk-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on Star-48/artemis-provenance-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
artemis_provenance_sdk-0.2.0-py3-none-any.whl -
Subject digest:
0d4ce3fb1a3e321bf3f0f0c4d27bd900a427f77465eed9ce9521d8503a500b1e - Sigstore transparency entry: 2758763386
- Sigstore integration time:
-
Permalink:
Star-48/artemis-provenance-sdk-python@450486a49efaee450d73b0d6dde3b7424cf1b1ee -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Star-48
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@450486a49efaee450d73b0d6dde3b7424cf1b1ee -
Trigger Event:
push
-
Statement type: