Skip to main content

haic-logging

haic-logging is a lightweight, application-agnostic logging library for Human–AI Collaboration (HAIC) systems.

It provides a standardized instrumentation layer that captures:

  1. A fine-grained event stream (for traceability and debugging), and
  2. A compact decisions artifact that serves as the stable input contract for HAIC evaluation metrics.

The library is intentionally decoupled from any UI, database, or platform. Application-specific logic (e.g., radiology workflows, databases) is expected to live outside the library as adapters.


Design Principles

  • Separation of concerns
    Logging is independent from evaluation and storage backends.

  • Minimal contract, maximal reuse
    Only a small set of fields is required to unlock core evaluation.

  • Pilot-friendly
    Missing or partial fields are tolerated; richer logs unlock richer metrics.


Installation

pip install haic-logging

Core Concepts

Events

Events are fine-grained interaction records intended for traceability.

Examples:

  • session_start
  • task_item_loaded
  • ai_suggestion_presented
  • human_decision
  • session_end

Events are written as an append-only JSONL stream.

Decisions

Decisions are metric-oriented interaction records. They are compact, stable, and designed to be consumed by haic-metrics.

A decision minimally includes:

  • actor_type: "human" | "ai" | "system"
  • action: controlled vocabulary (e.g. label_received, ai_evaluated)
  • object_id: unit of work (e.g. image ID)
  • t: timestamp

Optional fields:

  • duration_s
  • latency_ms
  • correct
  • payload

Quickstart

from haic_logging import HaicLogger

with HaicLogger(
    log_dir="./logs",
    pilot_tag="radiology-toy",
    app_name="annotation_tool",
    app_version="0.1.0",
    app_mode="labelling",
    model_name="baseline_detector",
    model_version="v0",
) as logger:

    logger.log_decision(
        actor_type="human",
        action="label_received",
        object_id="img_001",
        duration_s=2.3,
        correct=True,
    )

    logger.log_decision(
        actor_type="ai",
        action="ai_evaluated",
        object_id="img_001",
        latency_ms=120,
    )

    artifact_path = logger.export_decisions_artifact()

This produces:

  • run_<run_id>.jsonl (events)
  • haic_decisions_<run_id>.json (decisions artifact)

Decisions Artifact Schema (Simplified)

{
  "schema_version": "haic.decisions.v1",
  "session_id": "...",
  "run_id": "...",
  "meta": { ... },
  "decisions": [
    {
      "t": 1234567890.12,
      "actor_type": "human",
      "action": "label_received",
      "object_id": "img_001",
      "duration_s": 2.3,
      "correct": true
    }
  ]
}

This artifact is the formal interface to the evaluation engine.

What This Library Does NOT Do

  • It does not write to databases
  • It does not enforce domain semantics
  • It does not compute metrics

Those responsibilities belong to adapters and to haic-metrics.

Intended Usage Pattern

Application
   └── haic-logging
         ├── events.jsonl   (trace/debug)
         └── decisions.json (evaluation contract)

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

haic_logging-0.1.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

haic_logging-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file haic_logging-0.1.0.tar.gz.

File metadata

  • Download URL: haic_logging-0.1.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for haic_logging-0.1.0.tar.gz
Algorithm Hash digest
SHA256 66e96c3fd81a351edb7e3feacd55ddf15d391b1f72816827c36242b2f24cb46d
MD5 c0bf28ae4eabcd0cc827ad0c93bdcf66
BLAKE2b-256 285474960e05e641125176b5c6f4fe89a253d5e0e3f7d61bfab2c44a212210d8

See more details on using hashes here.

File details

Details for the file haic_logging-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: haic_logging-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for haic_logging-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a744e5f51820afe47d992cd56ded4ce6e8a554e834130be9151b764fee97e0ee
MD5 11dfa9d40c95019c0e6ff2469620f777
BLAKE2b-256 607317c1b0aab0b3944d02fbdf0c66e455e563bf841ae4195d17b2ce1072673e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page