Haldwani Times
Haldwani Times
Technology

argus-cortex 0.17.0

argus-cortex 0.17.0
Photo / Illustration: Haldwani Times Editorial Desk

Skip to main content Switch to mobile version argus-cortex 0.17.0 Shared foundation for the Argus suite: taxonomy, versioned wire-schema tooling, and the local/remote AI backend contract

pip install argus-cortex==0.17.0 Copy PIP instructions

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.

argus_cortex.taxonomy — TargetProfile / TargetStyle / TargetCategory / Modality / SpeechCategory, the "moat" types every stage inherits verbatim. modality defaults to image, so a profile without it reads as before; a speech profile takes a SpeechCategory (voice, accent, language, speaking_style; default voice), its target_backend names a TTS family (qwen3-tts, xtts-v2; default None) and target_style is ignored. A category of the other modality is refused. taxonomy_schema() renders them into the committed taxonomy-schema.json (make schema regenerates it; a test fails when it is stale), so non-Python clients generate their types instead of copying the literals.

argus_cortex.provenance: Provenance / ProvenanceKind, where a face, voice or image came from (the shape argus-mask#19 defined). personal needs only a source and is never cleared; stock, synthetic and consented are cleared, each states its licence, and consented also names its subject and the release_sha256 of the signed release (never the document). A consented subject is the name as the release gives it or the opaque subject ref consent:, which names no one (a ref for any other release is refused); pseudonymise(provenance) returns a consented provenance with its subject swapped for the ref, for anything that leaves the record holder (manifests, exports, logs). curated is reserved and not cleared. Strict: unknown fields and a blank source are refused, licence is read as license, and a stored cleared is recomputed. A synthetic or personal source may name its generator (model, model_sha256, seed, prompt; optional, refused on other kinds). provenance_schema() renders the committed provenance-schema.json (make schema; a test fails when it is stale).

argus_cortex.consent: a real person's likeness release, as argus-mask#26 defined it. ConsentRecord is keyed by the release_sha256 a consented Provenance names, and holds the subject, who collected it, signing and expiry dates (expiry must be stated, null for none), the age check (who and when, never the ID), the face/voice opt-ins, voice deliveries, uses (avatar, video, speech, training; training is off unless listed), sha256s of the reference images and recordings, revocation terms and any revocation. consent_valid(record, use=, likeness=, at=, delivery=) returns a ConsentVerdict (ok, reason, detail), checking in order revoked, not-yet-signed, expired, likeness-not-covered, use-not-covered, delivery-not-covered; at must be timezone-aware and dates compare as UTC days, so the check never reads the clock. consent_matches(record, provenance) checks the record is the release and subject a provenance names; the subject may be the record's name or subject_ref(record) (consent:). A record names a person, so services return only verdicts, never records. consent_schema() renders the committed consent-schema.json.

argus_cortex.wire — the versioned wire-schema toolkit: check_version() (major-compatibility gate), make_versioned_base() (a Pydantic base that stamps + checks a version field like proof_version / manifest_version), and wire_schema() / render_schema() for the committed-schema schema --check CLI pattern.

argus_cortex.backends — the AI-backend contract generalised from argus-lens: Backend / LocalBackend / RemoteBackend (point at a hosted service by base_url, host/port, or a known RemoteProvider), plus with_retries() and resolve_device(). httpx lives behind the [remote] extra.

argus_cortex.server — shared write-guard + env-flag scaffolding for the suite's FastAPI micro-servers: WriteGuard (a pure-ASGI method-gate that never buffers streaming responses), the constant_refuse() / cross_site_refuse() predicates (read-only/replay mode and cross-site-write protection are two configs of the one guard; a same-host write is trusted only for an IP literal, localhost or a name in trusted_hosts, so DNS rebinding cannot pass it), the UNSAFE_METHODS / TRUTHY / FALSY constants, and env_flag() (warns on a mistyped protection flag rather than silently disabling it). Starlette lives behind the [server] extra.

argus_cortex.fs: paths from outside stay under their root (the paved road for path traversal; design in docs/paved-roads.md). safe_join(root, user_path) returns the resolved path only when it is under root, so a symlink out is caught and what was checked is what gets used; the root itself and absolute input are opt-in (allow_root, allow_absolute), and empty input, NUL and \ are refused. safe_name() checks one id or slug with fullmatch (starts alphanumeric, so never ./.., and no trailing newline). safe_basename() keeps the last component of an upload filename across / and \. All refuse with PathRefused (a ValueError); is_within() is the boolean check. Stdlib only.

argus_cortex.net: outbound fetches of URLs from outside that can't be steered at the inside (the paved road for SSRF). fetch() / afetch() resolve the host once and require every address to be global (IPv4 inside IPv6 forms unwrapped), pin the connection to the checked address (Host header and SNI kept, so DNS rebinding can't swap it), follow GET/HEAD redirects by hand re-checking each hop, cap the body and the whole fetch's time, ignore proxy env vars, and refuse userinfo. allow_hosts (host or host:port) admits internal services by name, still pinned. Returns a Reply; refusals raise UrlRefused. httpx behind [remote].

argus_cortex.auth: bearer("ARGUS_ADMIN_TOKEN"), a FastAPI/Starlette dependency for admin routes that fails closed: unset token → 503 unless the route says open_when_unset=True (warned once); Authorization: Bearer with a case-insensitive scheme, compared with hmac.compare_digest on bytes; 401 + WWW-Authenticate: Bearer otherwise. check_bearer() is the core. Starlette behind [server].

argus_cortex.settings: one owner-only suite file for what every Argus service on a host shares, so the broker URL and token, the detector URLs and the store credentials are written once instead of once per repo. get(name) reads the process environment, then the file (ARGUS_ENV_FILE, else ~/.config/argus/suite.env, else /etc/argus/suite.env; off disables it), so a service's own setting always wins and a blank value (compose's ${NAME:-}) falls through. Everything cortex reads itself goes through it (gpu.coordinator_from_env(), StoreConfig.from_env(), auth.bearer(), server.env_flag(), peers), so a service picks the file up when it bumps cortex, with no code change. apply() copies the file's values into os.environ for code that reads the environment directly (a service's own settings, HF_TOKEN); it never sets PATH, LD_*, DYLD_* or PYTHON*. The file is read only if it belongs to this user or root and nobody else can write it, or read it unless root owns it (a root-owned 0444 container mount): a refused, missing or unreadable file is a warning and no settings, never a crash. It is re-read when it changes, so rotating a token needs no restart. Values are literal (NAME=value, no interpolation) and are never logged. python -m argus_cortex.settings shows which file is in use and which variables it sets (names only); --init creates one with mode 600. In a container the file is /etc/argus/suite.env, owned by root with group argus (gid 8120, SUITE_GID) and mode 640: mount the directory /etc/argus read-only and set group_add: ["8120"]. That one file works for an image that runs as root, for one that does not, and for a host user in the group, and no other local user can read it; bind-mounting your own mode-600 file works for neither kind of image. Mount the directory, not the file, so a replaced file reaches a running container and a host with no file still starts. --container prints the host steps and the compose lines, and --as UID[:GID,...] says whether a container's user would read the file (ADR-0009). Stdlib only.

argus_cortex.peers: where a service finds another one. peer_url("nudenet", "ARGUS_CURATOR_NUDENET_URL") returns the stage's own variable if set, else the suite-wide ARGUS_NUDENET_URL (peer_env(name): ARGUS__URL), else default, each read through settings; resolve_peer() also says which variable it came from. One NudeNet server is then configured once for curator, darkroom and proof, and each stage's old variable keeps working. Blank is unset; off stops the lookup, so one service can opt out of a suite-wide peer. A value that is not an absolute http(s) URL with a host raises PeerRefused, naming the variable and never the value: skipping it would read as "not configured" and turn a guard off on a typo. None means not configured, and whether that is acceptable stays the caller's rule. Discovery is opt-in: peer_url(..., discover=True) asks the suite's directory, argus-iris, for GET /directory/ after the variables and before the default. iris builds the directory from containers labelled argus.peer, so the URL is a node agent's host and the container's published port, never a host anyone supplied. It is asked only when both ARGUS_GPU_BROKER_URL and ARGUS_GPU_BROKER_TOKEN are set, because the answer decides where work (a moderation check) is sent; the token goes to that host only, and redirects are not followed. An answer is cached for 60 s and a miss for 15 s, and a lookup blocks for at most 2 s: on an event loop use apeer_url() / aresolve_peer(). A directory that is down, refuses the token or lists nothing is "not found", never an error, and an entry with credentials in its URL is skipped. A peer found once stays found for the life of the process: if a later lookup fails, the last URL is kept, so a guard does not read as "not configured" because the directory blinked, and a peer that has really gone fails its calls instead. A discovered Peer has source == "broker". The reply is service.PeerLookup (directory_version 1.0, committed as service-directory-schema.json): peer and urls, each a DirectoryEntry (peer, origin, service, node, container, running, url, reason, health_path, and health, an EntryHealth with what the directory last read). Stdlib only without discovery; discovery needs httpx ([remote]).

argus_cortex.service: what a service says about itself, one GET /health shape for the suite. ServiceHealth (service_version 1.1, committed as service-health-schema.json) carries service (the package), version, status, started_at, wire (the wire contracts it speaks and their versions), capabilities, checks (a DependencyCheck per dependency: ok, detail, latency_ms, required), read_only, build and peer. status is ok (every required check passes), degraded (it answers, but a required check failed) or starting; there is no down, since a process that answers is not down. It allows extra fields and shares no field name with ResidentHealth, so a GPU resident serves one body that is both. install_health(app, service=..., wire=, capabilities=, checks=, informational=, readiness=, extra=, read_only=) serves it on a Starlette or FastAPI app: 200 for ok and degraded, 503 for starting, so a container healthcheck can use it and a failed dependency does not restart the service. Checks are sync or async callables, cached for check_ttl_s (10 s) and bounded by check_timeout_s (2 s); a sync one runs in a worker thread, and while one is being refreshed other requests get its last result. GET /health?checks=0 runs no checks: use it for container healthchecks and for one service's check on another, so two services that check each other cannot wait on each other. extra adds the service's own fields (a resident's model_state, busy, idle_s, gpu) and can never replace one of the contract's. The route is unauthenticated, so nothing private goes in it: a check that raises reports the exception's type only, and user:password@ in a detail is removed. version defaults to the installed package version; build and peer default to ARGUS_BUILD (baked into the image) and ARGUS_PEER in the process's own environment, never the suite file. build_info_text() renders the argus_build_info{service,version,service_version[,build]} 1 gauge with no metrics library, metrics_route() serves just that at /metrics, and build_info_collector() is the same gauge for a service that already uses prometheus-client ([metrics]). Discovery labels: a service's compose file labels its container argus.peer (required: the name callers ask for, as in peers), and optionally argus.service, argus.health and argus.port (PEER_LABEL and the others); argus-iris's agents read them, because a process does not know its own host or published port. Models need pydantic only; the routes need [server]. capabilities is a list of names, or (1.1) a map of every capability to whether it is on, for a service whose clients already read one; capability_names gives the names that are on either way.

argus_cortex.suite_links: where to send a reader for each package: link_for("argus-echo") returns its docs page, else PyPI, else its demo, else GitHub (PRECEDENCE). PACKAGES holds every link a package has (PackageLinks: docs, pypi, demo, github); suite_links_json() renders the committed suite-links.json (make schema; a test fails when it is stale) for non-Python readers such as dragonhound.dev. When a docs page ships, set its docs here. A private repo has no entry until it is public. Stdlib only.

argus_cortex.limits: bounded reads of client input. read_body(request, max_bytes) (declared length checked first, chunked bodies counted), read_upload(upload, max_bytes) (reads in chunks, stops at the cap), decode_base64(data, max_bytes) (encoded length checked before decoding; data URIs accepted), open_image(data, max_pixels=, formats=) (pixel count from the header before any decode; JPEG/PNG/WEBP unless formats= opts in to more, never EPS), open_audio(data, max_seconds=60, max_channels=2, allowed_rates=None, max_bytes=None, mono=False) → Audio(samples, sample_rate) (WAV/FLAC sniffed from the magic bytes; channels, rate and duration from the header before any decode, then decoding stops at the cap whatever the header claimed; float32 (frames, channels); needs [audio]). TooLarge (→ 413) / BadInput (→ 400).

argus_cortex.xmp — the suite's one XMP sidecar implementation (hoisted from argus-lens): write_xmp() / read_xmp() / merge_xmp() / parse_xmp() over an XmpData model covering dc (keywords, description), xmp (Rating, Label), lr (hierarchical keywords), Iptc4xmpExt (PersonInImage), mwg-rs face/pet regions, and argus:ContentRating. Writes merge: each property you set replaces that property (latest write wins), everything else in the sidecar — Lightroom develop settings, GPS, another stage's fields — is preserved. None leaves a property alone, an empty value removes it. Writes are atomic; an unparseable existing sidecar raises XmpError instead of being clobbered. Stdlib + pydantic only.

argus_cortex.moderation — the suite's content-moderation clients, over HTTP to servers the deployer runs (nothing here imports a detector): NudeNetClient (a NudeNet server's /infer → NsfwResult: detections, per-class maxima, and an exposed score; rate_content() reads one as the suite's content rating, safe, suggestive or explicit; info() → NudeNetInfo, the model the server runs. Use a 640m server: the upstream image bundles 320n, which scores differently, so a threshold tuned on one does not carry to the other) SingGuardClient (a SingGuard server's /api/guard/check → GuardResult: verdict, the policy rules that fired, explanation; optional custom policy text) and OcrClient (argus-retina's OCR image, ghcr.io/smk762/argus-retina-ocr: read() → OcrResult, the lines of text in reading order with score and box; transcript() joins them, and contains(phrase) checks a claimed name or quote with normalize_text, ignoring case, spaces and punctuation, since OCR runs words together; info() → OcrInfo, the models and score floor). The OCR client reads and decides nothing: whether a claim fails is the caller's call, and a failed read raises OcrCheckFailed rather than returning no text. DEFAULT_EXPOSED_LABELS is the suite's one definition of nudity: the five exposed buttocks/breast/genitalia/anus classes — faces, covered parts, and bare feet, belly, armpits or male chest never count. Stdlib + pydantic; Pillow (for SingGuard's downscaling of large images, on by default) is behind [images]: without it SingGuardClient(...) raises ModerationConfigError at construction unless given downscale=False. A user:password@ in a URL is sent as HTTP Basic auth. URLs are passed in, never read from the environment here: each stage owns its config, and finds the URL with argus_cortex.peers. NudeNet itself is AGPL-3.0, which is why it stays behind an HTTP boundary.

argus_cortex.gpu: GPU tenancy, generalised from argus-lens. coordinator_from_env() returns a coordinator whose lease(caller=, min_vram_mb=) holds a GPU slot for a block of work. none (the default) grants every lease at once. lease takes an exclusive flock that every argus process on the host shares (one lock for the host, not per GPU), then waits until free_vram_mb() (NVML, behind [gpu]) reports min_vram_mb free across every process on the card, ComfyUI and Ollama included, which never take the lock. It raises GpuLeaseTimeout after ARGUS_GPU_LEASE_TIMEOUT_S (300 s). The VRAM check is a snapshot, not a reservation, and a probe that cannot run lets the lease through. Containers each have their own /tmp, so set ARGUS_GPU_LEASE_PATH to a file on a volume every GPU service mounts, or the lock coordinates nothing. ARGUS_GPU_DEVICE (default 0; an invalid value warns and falls back to 0) picks which card NVML probes for free VRAM; the lock stays host-wide. Broker. ARGUS_GPU_COORDINATOR=broker asks the suite's GPU broker, argus-iris, at ARGUS_GPU_BROKER_URL (bearer ARGUS_GPU_BROKER_TOKEN, optional) instead. With ARGUS_GPU_COORDINATOR unset, setting ARGUS_GPU_BROKER_URL alone selects the broker, so a URL and a token are all a service needs. The broker places the lease on one of the suite's GPU nodes, queues it by priority, holds a real VRAM reservation, and evicts idle models to make room. lease() now also takes optional priority (realtime/interactive/batch/background), target (comfyui, ollama:, in-process), kind, preemptible, constraints (GpuConstraints: node, min_cc, bf16) and model_mb (the part of min_vram_mb that is weights the service keeps loaded after the lease, such as a ComfyUI checkpoint or an Ollama model, so the broker counts them once rather than per lease); the local coordinators ignore them. Every coordinator yields a GpuLease: node and base_url say where the broker placed the work (call that URL; None means use your own), should_yield() turns true when the broker wants the GPU back (release at the next safe point; nothing is killed), and report_peak_vram(mb) feeds the broker's footprint learning, and report_progress(done, total, stage=...) puts a progress bar on the broker's dashboard. alease() is the async form on every coordinator; the file lease waits in a worker thread. Each lease carries a fresh request_id, so the one retry after a lost POST response returns the same lease rather than a second one. A broker lease heartbeats in the background, re-attaches if the broker restarts, and reports its outcome (ok/failed/oom/cancelled) on release. It fails open: unreachable or 5xx, and the lease comes from ARGUS_GPU_BROKER_FALLBACK (lease, the default, or none) with via="fallback"; a 4xx or an incompatible lease_version raises BrokerError, a refusal GpuLeaseRefused. httpx behind [remote].

Tenant manifests. Every repo that uses a GPU commits a gpu-tenant.yaml (argus_cortex.gpu_wire.TenantManifest): its kinds of work with target, declared VRAM, default priority and preemptibility, and the models it keeps resident with keepalive and idle-kill hints. ARGUS_GPU_TENANT_MANIFEST points the broker coordinator at it; unset, the first of ./gpu-tenant.yaml and /app/gpu-tenant.yaml (where the suite's images copy it) is used (gpu.MANIFEST_CANDIDATES, find_tenant_manifest()). It is registered with the broker before the first lease, again every five minutes, and again after the broker was unreachable or forgot a lease (the broker keeps tenants in memory, so a restart loses them); ARGUS_GPU_TENANT names the tenant if there is no manifest. A service that keeps models resident registers at startup instead: wrap its lifetime in gpu.aregistered(coordinator) (a FastAPI lifespan) or gpu.registered(coordinator) (a no-op for the local coordinators), which registers in the background, re-registers every five minutes (30 s after a failure), never blocks startup on the broker, and sends DELETE /tenants/{tenant} on the way out; BrokerCoordinator.register()/aregister() and unregister()/aunregister() do one call each. Every POST /tenants carries X-Argus-Container-Id (this process's 64-hex container id from /proc/self/mountinfo or /proc/self/cgroup, gpu_broker.own_container_id(); left out outside a container), so the broker can find the node, GPU and published ports through its node agents, and, when a resident in the manifest has admin_auth, X-Argus-Admin-Token: the token the broker presents to the service's /admin/* routes, read from the variable ARGUS_GPU_ADMIN_TOKEN_ENV names (default ARGUS_ADMIN_TOKEN; empty sends none). Neither goes into the manifest. A resident's optional port (tenant_version 1.1) is the port it listens on inside its container, for a container that publishes several. load_tenant_manifest() reads YAML (behind [yaml]) or JSON. The lease wire models and the manifest render the committed gpu-lease-schema.json and gpu-tenant-schema.json (make schema; drift-tested), so non-Python callers and repos validate against those.

Resident replies. What an argus-http resident's routes return to the broker, committed as gpu-resident-schema.json. GET /health answers a ResidentHealth: top-level model_state (unloaded, loading, cpu, gpu, error), busy, idle_s (null while busy or unloaded), and an optional gpu block of memory only (free_vram_mb, allocated_mb, reserved_mb, total_mb). POST /admin/unload, /admin/evict and /admin/wake answer a ResidentActionReply (status, the model_state after the action, and unloaded: true when memory was freed). While work runs, an admin route either waits or answers 409 with a ResidentBusyReply ({"status": "busy", "active": n}): nothing was done, retry after the work finishes. 503 means loading or unavailable. All three allow extra fields, so a service keeps its own.

argus_cortex.store — the optional stateful services layer (the suite's persistent "memory"). External and opt-in — every store is configured by CORTEX_* env vars and no-ops when its URL is unset. Phase 1 — Postgres lineage store. Persists the source_asset → caption → human_edit → dataset_membership → training_run DAG for LoRA reproducibility, edit capture, and the feedback loop. Backed by a psycopg connection pool (concurrent asyncio.to_thread calls are safe; a dropped connection is replaced), with a transaction() boundary for atomic multi-step writes. open_lineage_store() returns a no-op store when CORTEX_PG_URL is unset; psycopg lives behind the [postgres] extra.

Phase 2 — Qdrant vector store. Stores image + tag-set embeddings for retrieval-augmented few-shot and near-duplicate curation; put a caption_id/asset_id in a point's payload and a search hit joins straight back to the lineage. open_vector_store() no-ops when CORTEX_QDRANT_URL is unset; qdrant-client lives behind the [qdrant] extra. cortex stores vectors it's handed — computing embeddings is the caller's job.

Phase 3 — MinIO/S3 blob store. Owns image bytes when cortex can't rely on the filesystem/Immich (exported/selected training images). Blobs are content-addressed on sha256 (content_key() == source_asset.sha256), so storage, dedup, and lineage join share one identity. open_blob_store() no-ops when CORTEX_S3_ENDPOINT/CORTEX_S3_BUCKET are unset; the minio client lives behind the [s3] extra.

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_BROKER_URL=http://:8120 (+ ARGUS_GPU_BROKER_TOKEN) 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).

Released: Nov 29, 2026

Both files in this release have provenance metadata.

View provenance details

MIT View SPDX License List

audio codemods dev gpu images metrics postgres qdrant remote s3 server yaml

Development Status 3 - Alpha

Intended Audience Developers

License OSI Approved :: MIT License

Programming Language Python :: 3

Release files for argus-cortex 0.17.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Built distribution (wheel)

Total release size: 596.1 kB

Release files / argus_cortex-0.17.0.tar.gz

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 Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Release files / argus_cortex-0.17.0-py3-none-any.whl

Security for argus-cortex 0.17.0

Both files in this release have been uploaded with provenance metadata.

With provenance argus_cortex-0.17.0.tar.gz Nov 29, 2026

With provenance argus_cortex-0.17.0-py3-none-any.whl Nov 29, 2026

Attestation for argus_cortex-0.17.0.tar.gz

Attestation for argus_cortex-0.17.0-py3-none-any.whl

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.

Release history Release notifications | RSS feed

Nov 29, 2026 2 release files Full provenance

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

"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.

© 2026 Python Software Foundation

Deployed from fc0d8e6

Source Attribution: This report incorporates information referenced or syndicated from Pypi.org. Read original coverage at Pypi.org.

More from Technology →
Haldwani Times
Haldwani Times Independent News & Editorial
Login
MARKETS & FINANCE
BRENT CRUDE: $78.40 -0.52% SENSEX: 81,450.20 +0.42% NIFTY 50: 24,820.15 +0.38% GOLD (24K): ₹74,500/10g -0.18% USD/INR: ₹95.54 +0.10%

ADMINISTRATIVE LEADERSHIP

Mr. Narendra Modi
Mr. Narendra Modi
Mr. Lt. Gen. Gurmit Singh
Mr. Lt. Gen. Gurmit Singh
Mr. Pushkar S. Dhami
Mr. Pushkar S. Dhami
Mr. Lalit M. Rayal
Mr. Lalit M. Rayal
Mr. Gajraj S. Bisht
Mr. Gajraj S. Bisht

Top Headlines & Breaking Stories

View All News →

Haldwani Times – Everything in Haldwani: News, Shops, Businesses & Services

Haldwani Times is the premier digital news and commercial discovery platform built specifically for the citizens, business owners, students, professionals, and visitors of Haldwani, Nainital district, and the wider Kumaon region of Devbhoomi Uttarakhand. As the economic gateway to the Kumaon Himalayas, Haldwani is a bustling metropolis connecting the plains of northern India with the scenic mountain districts of Nainital, Almora, Pithoragarh, Bageshwar, Champawat, and Udham Singh Nagar. Haldwani Times serves as the definitive digital heartbeat of the city, bringing breaking hyperlocal news, verified commercial directories, educational updates, healthcare guides, Mandi Bhav rates, and civic announcements onto a single unified, trusted platform.

The Definitive Source for Breaking Haldwani News & Civic Updates

Haldwani stands as one of the fastest-growing urban conglomerates and commercial engines in northern India. Positioned in the fertile Terai-Bhabhar belt at the foothills of the Shivalik range, the twin cities of Haldwani and Kathgodam form the administrative and logistical nerve center for the entire Kumaon division. With rapid urbanization, expanding commercial infrastructure, flourishing educational centers, and increasing inter-state transit, the demand for fast, fact-checked, and unbiased local journalism has never been greater. Haldwani Times delivers 24/7 comprehensive news coverage built on rigorous journalistic standards: - **Hyperlocal Civic News:** Real-time coverage of municipal corporation affairs, city drainage projects, traffic management blueprints, and road widening drives across Tikonia, Mukhani, Kusumkhera, Bareilly Road, and Rampur Road. - **Administrative Directives:** Official notifications from the District Magistrate (DM) Nainital, Senior Superintendent of Police (SSP), and state secretariat decisions affecting citizen welfare. - **Kumaon Weather & Disaster Alerts:** Timely mountain rainfall warnings, landslide advisories along NH-109 (Haldwani-Nainital Highway), and emergency bulletins during the monsoon and winter seasons. - **Education & Campus News:** Timely reports on Kumaon University examination schedules, Uttarakhand Board (UBSE) results, medical college admissions, and competitive coaching updates. - **Commercial & Market Trends:** Daily wholesale Mandi Bhav rates from Haldwani Subzi Mandi, real estate trends, retail market festivals, and local business openings. - **Cultural & Pahadi Heritage:** In-depth feature stories celebrating Kumaoni folk traditions, Aipan art, Nanda Devi festivals, and local community milestones.

Everything in Haldwani on One Unified Digital Ecosystem

Beyond traditional news reporting, Haldwani Times is engineered as an exhaustive local discovery engine. Historically, finding verified local business telephone numbers, emergency hospital contacts, specialized doctors, reliable plumbers, or trusted real estate consultants in Haldwani required asking neighbors or browsing outdated social media posts. Haldwani Times eliminates this friction by organizing every commercial, professional, and civic resource into searchable, verified categories. Whether you are a newly arrived resident in Kusumkhera looking for high-speed broadband providers, a parent searching for reputable CBSE schools near Kaladhungi Road, or a tourist seeking taxi rentals to Nainital, our portal delivers accurate, verified, and actionable information in seconds.

Local Shops, Retail Hubs & Traditional Bazaars in Haldwani

The retail commerce of Haldwani spans centuries-old traditional bazaars and modern commercial complexes: - **Bada Bazaar & Mangal Parao:** The historic retail heart of Haldwani, renowned for traditional Kumaoni wedding jewelry (Pauji, Guloband, Nath), brass utensils, ethnic handlooms, and wholesale clothing. - **Nainital Road & Tikonia Commercial Corridor:** Modern multi-brand retail showrooms, electronics stores, authorized smartphone service centers, branded footwear outlets, and international apparel stores. - **Bareilly Road & Rampur Road Trade Hubs:** Major agricultural machinery dealers, hardware and building material wholesalers, furniture manufacturing units, plywood distributors, and automobile showrooms. - **Subzi Mandi & Wholesale Grain Market:** One of the largest agricultural distribution centers in North India, supplying fresh vegetables, hill fruits (apples, peaches, plums), and organic Pahadi pulses (Gahat, Bhatt, Rajma) across northern states.

Healthcare Hub of Kumaon: Hospitals & Emergency Services

Haldwani serves as the premier medical lifeline for all six hill districts of Kumaon. Patients travel from Almora, Pithoragarh, Bageshwar, and Champawat to access specialized clinical treatments in Haldwani: - **Government Healthcare Institutions:** Dr. Susheela Tiwari Government Medical College & Hospital (STGH) and Base Hospital Haldwani provide tertiary trauma care, specialized super-specialties, pediatric ICUs, and 24/7 emergency response. - **Private Multi-Specialty Hospitals:** Advanced private medical centers specializing in cardiology, joint replacements, neurology, critical care, nephrology, and advanced laparoscopic surgeries. - **Diagnostic Centers & 24/7 Pharmacies:** Fully automated pathology laboratories, high-resolution MRI/CT scan centers, and round-the-clock emergency pharmacies clustered around Medical College Road, Kaladhungi Road, and Rampur Road.

Education, Colleges, Coaching Academies & Youth Development

Haldwani is the educational capital of the Kumaon region, home to thousands of ambitious students preparing for medical, engineering, defense, and civil services careers: - **Premier Degree Colleges:** Motiram Baburam Government Post Graduate College (MBPG College) and Women's Degree College providing extensive undergraduate and postgraduate humanities, commerce, and science programs. - **Competitive Coaching Ecosystem:** Highly reputed coaching academies for NEET UG, JEE Main & Advanced, UPSC Civil Services, UKPSC/UKSSSC, NDA, CDS, and Banking examinations along Kaladhungi Road and Tikonia. - **Affiliated Schooling Infrastructure:** Esteemed CBSE, ICSE, and Uttarakhand Board schools imparting value-based holistic education with modern sports and laboratory facilities.

Real Estate, Housing Colonies & Urban Expansion Trends

Driven by rapid infrastructure expansion and high quality of life, Haldwani's real estate market is expanding outward into organized residential colonies: - **Prime Residential Localities:** Highly sought-after residential sectors in Mukhani, Kusumkhera, Kaladhungi Road, Judge Farm, Daharia, and Bhotia Parao offering planned housing, green parks, and modern civic amenities. - **Commercial Property Investments:** Thriving commercial retail complexes, office spaces, and warehouse hubs developing rapidly along the proposed Haldwani Ring Road and transport corridors. - **Property Advisory & RERA Compliance:** In-depth real estate updates, circle rate revisions by the Nainital district administration, and buyer advisory guidelines for safe property acquisitions.

Strategic Transit Gateway, Tourism Routes & Kumaon Himalayan Connectivity

Haldwani-Kathgodam is the vital transit bridge connecting the plains of Delhi NCR and Uttar Pradesh with the hill stations of Uttarakhand: - **Kathgodam Railway Terminal:** Connecting Kumaon directly to New Delhi (Shatabdi Express, Ranikhet Express), Lucknow, Kolkata, Jammu, and Dehradun. - **ISBT Haldwani:** Operating round-the-clock interstate and mountain bus routes managed by Uttarakhand Transport Corporation (UTC) and private deluxe coaches. - **Pantnagar Airport (PGH):** Located just 26 km from Haldwani, offering scheduled domestic flights to New Delhi, Dehradun, Pithoragarh, and regional hubs. - **Himalayan Tourism Hub:** The primary staging point for journeys to Nainital (34 km), Bhimtal (30 km), Mukteshwar (72 km), Kainchi Dham (42 km), Almora (90 km), Ranikhet (80 km), and Jim Corbett National Park (55 km).

Gaula River Mining, Ecological Balance & The Bhabhar Economy

The Gaula River represents the undisputed economic and hydrological lifeline of Haldwani and the broader Nainital district. Originating from the Sattal-Bhimtal catchment in the lesser Himalayas, the river flows south past Kathgodam and Haldwani before merging into the Ramganga. For generations, the Gaula riverbed has provided the foundation for both regional agriculture and the construction economy across northern India: - **Regulated Minor Mineral Extraction:** During the open mining season (typically October to May), thousands of registered tractor-trolleys and heavy dumpers harvest riverbed gravel, sand, and boulders under strict surveillance by the Uttarakhand Forest Development Corporation and the Nainital district administration. - **Livelihood Support for Over 50,000 Families:** The Gaula mining economy directly and indirectly sustains vehicle owners, drivers, mechanics, diesel pump stations, roadside eateries, and local laborers, circulating over ₹500 crore into Haldwani's local markets annually. - **Environmental Safeguards & Flood Mitigation:** In strict adherence to High Court and National Green Tribunal (NGT) directives, scientific replenishment studies, satellite GPS tracking on transport vehicles, and seasonal mining bans during the monsoon protect the river's ecological balance and prevent bank erosion along low-lying residential sectors.

Culinary Landscape: From Traditional Kumaoni Rasoi to Modern Cafes

Haldwani's gastronomic scene reflects a delightful blend of rustic mountain traditions and cosmopolitan dining: - **Authentic Kumaoni Specialties:** Local restaurants and heritage dhabas serve traditional mountain delicacies cooked in iron vessels, including Bhatt ki Churkani (black soybean curry), Gahat ke Dubke (horsegram puree), Aloo ke Gutke tempered with wild Himalayan chives (Jamboo) and Jakhiya, and refreshing cucumber Raita flavored with freshly crushed mustard seeds. - **Traditional Confectioneries:** Historic sweet shops along Bada Bazaar and Nainital Road craft Almora's world-famous Bal Mithai (roasted caramelized khoya fudge coated in sugar balls) and Singaudi (sweetened khoya wrapped in wild Malu leaves). - **Vibrant Street Food & Cafe Culture:** As dusk falls, Tikonia and Nainital Road come alive with bustling street food stalls offering steaming Tibetan momos, spiced thukpa, Kathi rolls, and hot Masala Chai, alongside modern rooftop cafes serving specialty Italian coffees and continental snacks.

Cultural Festivals, Folk Heritage & The Aipan Art of Kumaon

Beyond commercial enterprise, Haldwani is the proud cultural showcase of Devbhoomi Uttarakhand: - **Aipan Folk Art Tradition:** The sacred geometrical floor and wall art handcrafted with red ochre (Geru) and white rice paste (Biswar) adorning thresholds, altars, and chowkis during auspicious ceremonies, now preserved through local women's self-help cooperatives. - **Classical Baithki & Khadi Holi:** Unique to Kumaon, musical celebrations starting as early as the month of Paush, featuring classical Hindustani ragas sung in community courtyards followed by energetic Chholiya dance performances during spring. - **Nanda Devi & Chholiya Heritage:** Grand annual fairs celebrating the patron deity Nanda Devi, accompanied by martial sword-and-shield Chholiya dancers whose rhythmic brass trumpets (Ransingha) and hurka drums resonate through the valley.

Public Amenities, Parks & Community Spaces in Haldwani

Urban lifestyle and recreational infrastructure in the city: - **Green Parks & Walking Tracks:** Walkway projects around Daharia, Judge Farm, and Awas Vikas providing lush recreational zones for families and seniors. - **Community Centers & Sports Grounds:** Multi-purpose auditoriums and grounds hosting cultural melas, badminton tournaments, and community celebrations. - **Gaula Barrage & Forest Trails:** Scenic river viewpoints and natural birdwatching areas attracting eco-tourists and local nature enthusiasts on weekends.

Frequently Asked Questions (FAQs)

How can I access live breaking news and weather alerts for Haldwani?

Haldwani Times operates a dedicated 24/7 hyperlocal newsroom providing real-time breaking bulletins, traffic alerts, and meteorological warnings. You can access live news directly from our homepage, subscribe to instant browser push notifications, or view categorical updates on Uttarakhand, Education, and Mandi Bhav. During monsoon and winter weather events, our correspondents provide live updates on NH-109 road blockages and emergency administrative orders issued by the Nainital District Magistrate.

Is Haldwani Times completely free to read for all visitors?

Yes, Haldwani Times offers completely unrestricted, open-access reading to all users without mandatory paywalls. Readers across Haldwani, Uttarakhand, and the global diaspora can freely browse all breaking news reports, investigative articles, business directory listings, and historical archives. Our public-interest mission ensures that essential civic information, emergency hospital directories, and educational circulars remain universally accessible to everyone at zero cost.

How can local business owners list their shop or service in the Haldwani directory?

Local merchants, medical practitioners, schools, and service professionals can register their business by navigating to our 'Business Directory' page and selecting 'Add Listing'. The registration process allows you to input your business name, address, contact numbers, operational hours, services offered, and high-resolution showroom photographs. Once submitted, our local verification team verifies the physical address within 24 hours to ensure high consumer trust and top ranking on Google.

Can I read Haldwani Times articles in Hindi as well as English?

Yes, Haldwani Times features a seamless, native bilingual reading experience tailored for our regional readership. With our one-click language toggle located prominently in the navigation bar, you can instantly switch between English and pure Hindi. Both versions feature carefully crafted editorial phrasing, accurate regional terminology, and culturally resonant storytelling to ensure maximum readability for students, families, and senior citizens alike.

How do I submit news tips, event notices, or press releases to the editorial team?

Our newsroom warmly welcomes verified news tips, community event notices, civic grievances, and official press releases from citizens and local organizations. You can submit your documents, photos, or video evidence directly to our central editorial desk at editorial@haldwanitimes.com or via our Help & Support page. Our senior editors review every submission for factual authenticity, multi-source verification, and public relevance prior to publication.

Where can visitors find authentic Kumaoni Bal Mithai and Singaudi in Haldwani?

Renowned traditional sweet houses clustered along Bada Bazaar, Mangal Parao, Kathgodam Station Road, and Nainital Road specialize in daily batches of authentic Bal Mithai and fragrant Singaudi prepared with pure mountain dairy khoya and natural ingredients.

What transportation options are available for traveling from Haldwani to Nainital and Bhimtal?

Continuous state transport buses (UTC), KMOU coaches, and registered taxi union sharing cabs operate 24/7 from the Haldwani Roadways Bus Station (near Tikonia) and Kathgodam Railway Station. Fares are regulated by the transport department, with mountain travel times ranging between 1 to 1.5 hours.