Shared foundation for the Argus suite: taxonomy, versioned wire-schema tooling, and the local/remote AI backend contract.
Part of the Argus suite; SUITE.md lists every repo, what it owns, and how they fit together. This is the library the stages import so the code they share — the target taxonomy, the wire-schema versioning discipline, and the way they call local or hosted models — lives in one place instead of being copy-pasted per repo.
from argus_cortex.wire import make_versioned_base, render_schema from argus_cortex.backends import RemoteBackend, RemoteProvider # per-package versioned base (readable field name kept local, logic shared) _Versioned = make_versioned_base("proof_version", "1.0", ("1",)) # reach a hosted scorer by IP/port, or a known provider scorer = RemoteBackend.from_host(" ", 9000, api_key="…") # real host/IP: local .env nim = RemoteBackend.from_provider(RemoteProvider.NVIDIA_NIM, api_key="…") from argus_cortex.xmp import XmpData, XmpRegion, XmpRegions, write_xmp # lens writes captions/keywords … write_xmp("pics/beach.jpg", XmpData(keywords=["beach", "sunset"], description="a beach at sunset")) # … curator later adds faces + a content rating to the same sidecar; lens's fields survive write_xmp( "pics/beach.jpg", XmpData( persons=["Ada"], regions=XmpRegions(width=4000, height=3000, regions=[XmpRegion(x=0.52, y=0.4, w=0.1, h=0.18, name="Ada")]), content_rating="safe", ), ) from argus_cortex.moderation import NudeNetClient, SingGuardClient, rule_matches nudenet = NudeNetClient("http://nudenet:8080") # its origin; /infer is appended result = nudenet.check(image_bytes, "beach.jpg") result.exposed_score # 0.0-1.0 over DEFAULT_EXPOSED_LABELS; result.labels = per-class maxima guard = SingGuardClient("http://guard:9150", policy=None) # None = SingGuard's default rules # thinking="fast" (default) is a verdict and rule; "fast-slow" also writes why; "slow" writes why # with no fast verdict ahead of the reasoning; "cascade" is fast, then slow only for what fast # flagged (the last two: agent-composer's guard or argus-cull's singguard service). verdict = guard.check(image_bytes, text="the prompt, if any") preflight = guard.check_text("the prompt") # no image: judge a prompt before it is run verdict.safe, verdict.rules # False, ["B. Real-World Crimes & Public Safety"] any(rule_matches(r, "B") for r in verdict.rules) # match a rule by letter or full name from argus_cortex.moderation import OcrClient reader = OcrClient("http://ocr:8133") # argus-retina-ocr's origin; /infer is appended text = reader.read(image_bytes, "diploma.jpg") text.transcript() # "KONGLIGA SVENSKA\nafProfessor\nenriBequerel\n…", in reading order text.contains("af Professor") # True: compared without case, spaces or punctuation text.contains("Henrik Bohr") # False: the caption claims text the image doesn't carry text.contains("Henri Becquerel", min_score=0.9) # only count lines read with at least this confidence from argus_cortex.moderation import SingGuardClient, policies guard = SingGuardClient("http://guard:9150", policy=policies.policy_text("adult-granular")) verdict = guard.check(image_bytes) illegal = [r for r in verdict.rules if policies.is_illegal("adult-granular", r)] # A, H or I policies.mode("adult-granular"), policies.mode("default") # "nsfw", "sfw" Stages ask for a policy by name; policies holds each one's text, the rules that mean illegal content under it, and its SFW/NSFW mode (default and sfw-* are SFW). The known names are policies.POLICIES; any other name raises ModerationConfigError (an sfw-* name gets mode sfw but has no text):
adult-granular, adult-cautious and adult-cinematic are under evaluation against adult; one adult policy remains at release, beside default.
from argus_cortex.gpu import GpuLeaseTimeout, coordinator_from_env gpu = coordinator_from_env() # ARGUS_GPU_COORDINATOR=lease, ARGUS_GPU_LEASE_PATH=/shared/argus-gpu.lock try: with gpu.lease(caller="faces", min_vram_mb=1500): # one argus job at a time, and 1.5 GB free run_the_model() except GpuLeaseTimeout: ... # no slot in time: back off, or answer 503 Through the broker, the same code can ask for a placement and honour a yield:
gpu = coordinator_from_env() # ARGUS_GPU_COORDINATOR=broker, ARGUS_GPU_BROKER_URL=http:// :8120 async with gpu.alease(caller="expand", min_vram_mb=6000, target="ollama:qwen3:8b", priority="interactive") as lease: ollama = lease.base_url or settings.ollama_url # the node the broker placed it on, else your own ... with gpu.lease(caller="bake", min_vram_mb=9000, target="comfyui", priority="batch", preemptible=True) as lease: for tile in tiles: if lease.should_yield(): break # requeue the rest; a higher-priority job wants the card bake(tile) Each check() raises CheckFailed (NudeNetCheckFailed / GuardCheckFailed) for a network error or an unusable answer, so a caller checking many images can record "unchecked" against the one image — and should treat unchecked as not safe. Bad configuration raises ModerationConfigError, whose message never echoes the URL.
from argus_cortex.store import open_lineage_store, SourceAsset, Caption, HumanEdit # no-op if CORTEX_PG_URL is unset; PostgresLineageStore if it's set store = open_lineage_store() # reads CORTEX_* from the environment store.ensure_schema() # idempotent bootstrap of the lineage tables # one atomic unit — the asset + caption + edit commit together or not at all with store.transaction(): asset_id = store.record_asset(SourceAsset(uri="immich://…", sha256="…")) # lens emits a CaptionResult; cortex ingests it (cortex never imports lens) cap_id = store.record_caption(asset_id, Caption.from_caption_result(result, profile={...})) store.record_edit(cap_id, HumanEdit(edited_caption="…", editor="alice")) # the (model_caption, edited_caption) pairs the summariser feedback loop trains on pairs = store.caption_edit_pairs() from argus_cortex.store import open_vector_store, IMAGE_COLLECTION # no-op if CORTEX_QDRANT_URL is unset; QdrantVectorStore if it's set vec = open_vector_store() vec.ensure_collection(IMAGE_COLLECTION, dim=512) # idempotent # store an embedding you computed, tagged with its lineage id vec.upsert(IMAGE_COLLECTION, point_id=cap_id, vector=embedding, payload={"caption_id": cap_id}) # retrieve similar past captions to steer the summariser (few-shot) hits = vec.search(IMAGE_COLLECTION, vector=query_embedding, top_k=5) similar_caption_ids = [h.payload["caption_id"] for h in hits] # join back to Postgres from argus_cortex.store import open_blob_store # no-op if CORTEX_S3_ENDPOINT / CORTEX_S3_BUCKET are unset; S3BlobStore if set blobs = open_blob_store() blobs.ensure_bucket() # content-addressed: the returned key IS the sha256 (== source_asset.sha256) sha = blobs.put_content_addressed(image_bytes, content_type="image/jpeg") data = blobs.get(sha) # bytes, or None if absent link = blobs.url(sha, expires=3600) # presigned GET URL Install uv pip install argus-cortex # core (pydantic only) uv pip install "argus-cortex[remote]" # + httpx for RemoteBackend and the GPU broker client uv pip install "argus-cortex[server]" # + starlette for argus_cortex.server (WriteGuard, env_flag) uv pip install "argus-cortex[postgres]" # + psycopg for the lineage store uv pip install "argus-cortex[qdrant]" # + qdrant-client for the vector store uv pip install "argus-cortex[s3]" # + minio for the blob store uv pip install "argus-cortex[images]" # + Pillow for SingGuardClient downscaling (on by default) uv pip install "argus-cortex[audio]" # + soundfile and numpy for limits.open_audio (WAV/FLAC) uv pip install "argus-cortex[gpu]" # + nvidia-ml-py for the GPU lease's free-VRAM probe uv pip install "argus-cortex[yaml]" # + PyYAML for reading a gpu-tenant.yaml (JSON needs nothing) The stateful services are configured via CORTEX_* env vars — see .env.example. Each is optional: leave a URL unset and that feature degrades to a no-op.
make install # venv + editable install with the "dev" extras make test make lint CI / Release CI runs via the shared argus-ci reusable workflow. Release publishes to PyPI (OIDC trusted publishing) on v* tags. No container image — this is a library. Versioning is derived from git tags via hatch-vcs — tag vX.Y.Z to cut a release. This repo was scaffolded from argus-pkg-template. Run copier update to pull template changes (CI, release, tooling).
Both files in this release have provenance metadata.
audio codemods dev gpu images postgres qdrant remote s3 server yaml
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
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.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Both files in this release have been uploaded with provenance metadata.
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.
Nov 23, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Nov 20, 2026 2 release files Full provenance
Nov 19, 2026 2 release files Full provenance
Nov 16, 2026 2 release files Full provenance
Nov 15, 2026 2 release files Full provenance
Nov 14, 2026 2 release files Full provenance
Nov 13, 2026 2 release files Full provenance
Nov 6, 2026 2 release files Full provenance
Oct 31, 2026 2 release files Full provenance
Oct 30, 2026 2 release files Full provenance
Oct 29, 2026 2 release files Full provenance
Oct 27, 2026 2 release files Full provenance
Oct 26, 2026 2 release files Full provenance
Oct 25, 2026 2 release files Full provenance
Jul 21, 2026 2 release files Full provenance
Jul 8, 2026 2 release files Full provenance




