Skip to main content

Writer for the Ingero agent annotation socket. Speaks the agent v0.17+ NDJSON annotation protocol; framework-agnostic.

Project description

ingero-annotate

Writer for the Ingero agent annotation socket. Speaks the agent's v0.17 NDJSON annotation protocol and nothing else, so any training framework or inference frontend can inject step, epoch, task_id, request_id, model, or any custom label into a live recorded trace without a framework-specific dependency.

Install

pip install ingero-annotate

Use

from ingero_annotate import AnnotationWriter

writer = AnnotationWriter()               # default socket: /run/ingero/annotate.sock
writer.write({"step": "42"})              # instant annotation
writer.write_span({"epoch": "3"}, ...)    # span annotation

The full public surface is documented in the module's docstring; see python/ingero-annotate/ingero_annotate.py.

The agent must be running with the annotation socket bound (ingero trace --record --annotate). When the socket is absent or the agent has not bound it, the writer drops silently and the caller's code path is untouched.

What this is and is not

This is the protocol layer. It validates label keys and values against the agent's contract (pkg/contract/annotate.go in the agent repo), opens the Unix-domain socket, sends NDJSON, handles reconnect, and gives you back a small Python API. It has no framework dependency.

The framework adapters live in the Ingero agent repository under examples/integrations/:

  • pytorch-lightning/ingero_lightning.py (Lightning callback)
  • ray/ingero_ray.py (Ray task hook)
  • hf-trainer/ingero_hf.py (HF Trainer callback)
  • deepspeed/ingero_deepspeed.py (DeepSpeed wrapper)
  • accelerate/ingero_accelerate.py (Accelerate hook)
  • vllm/ingero_vllm.py (per-request inference emitter, v0.19+)

Each of those imports from this package and adds the framework-specific wiring.

Wire protocol summary

Each line is one NDJSON annotation object:

{"labels": {"step": "42"}, "pid": 1234, "ts": 1700000000000000000}

labels is required. pid scopes to a process incarnation; without it the annotation is trace-wide. ts is optional unix nanoseconds (the agent stamps receive time when absent). Spans add span_start and span_end (both unix nanoseconds).

The full contract, including label-key/value charsets, length limits, and the v0.19 per-request keys, is documented in pkg/contract/annotate.go and docs/commands.md in the agent repository.

Honesty notes for per-request inference correlation

v0.19+ adds request_id, model, prompt_len, output_len, preempted, arrival, first_token, finished to the contract. When used with ingero explain --by-request / ingero query --by-request, the output is a TIME-OVERLAP slice, not exclusive kernel ownership. Continuous batching shares kernel launches across many in-flight requests; the agent's renderer prints this caveat verbatim every time. The library does not interpret request_id semantics beyond label validation; the agent does.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ingero_annotate-0.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

ingero_annotate-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ingero_annotate-0.1.0.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ingero_annotate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 24680639907290ca5c75bfd5ca28f1101a1af5962aa68714e3b8fcf0fc87caaf
MD5 586689c4c149eecb4dd0008b55cb7246
BLAKE2b-256 f5299579bbc3574beec5eb9204036aaa68a03ae6b28583181e14a407df96e609

See more details on using hashes here.

Provenance

The following attestation bundles were made for ingero_annotate-0.1.0.tar.gz:

Publisher: publish-pypi.yml on ingero-io/ingero

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: ingero_annotate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ingero_annotate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4adc79edaf37a70683f5d4f619e8cd012c043298f9eadb56e8060de20117afcc
MD5 2675477bfb821d34bae51562093dd9a2
BLAKE2b-256 7cd8d29db30d2ea6d7f03495a3a607e2266fd36b215d0e59d326cb9e763b17e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for ingero_annotate-0.1.0-py3-none-any.whl:

Publisher: publish-pypi.yml on ingero-io/ingero

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page