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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24680639907290ca5c75bfd5ca28f1101a1af5962aa68714e3b8fcf0fc87caaf
|
|
| MD5 |
586689c4c149eecb4dd0008b55cb7246
|
|
| BLAKE2b-256 |
f5299579bbc3574beec5eb9204036aaa68a03ae6b28583181e14a407df96e609
|
Provenance
The following attestation bundles were made for ingero_annotate-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on ingero-io/ingero
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ingero_annotate-0.1.0.tar.gz -
Subject digest:
24680639907290ca5c75bfd5ca28f1101a1af5962aa68714e3b8fcf0fc87caaf - Sigstore transparency entry: 1624642261
- Sigstore integration time:
-
Permalink:
ingero-io/ingero@85466ee1ea58d6a0ada59d143b77acb9f4e93242 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ingero-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@85466ee1ea58d6a0ada59d143b77acb9f4e93242 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4adc79edaf37a70683f5d4f619e8cd012c043298f9eadb56e8060de20117afcc
|
|
| MD5 |
2675477bfb821d34bae51562093dd9a2
|
|
| BLAKE2b-256 |
7cd8d29db30d2ea6d7f03495a3a607e2266fd36b215d0e59d326cb9e763b17e4
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ingero_annotate-0.1.0-py3-none-any.whl -
Subject digest:
4adc79edaf37a70683f5d4f619e8cd012c043298f9eadb56e8060de20117afcc - Sigstore transparency entry: 1624642266
- Sigstore integration time:
-
Permalink:
ingero-io/ingero@85466ee1ea58d6a0ada59d143b77acb9f4e93242 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ingero-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@85466ee1ea58d6a0ada59d143b77acb9f4e93242 -
Trigger Event:
workflow_dispatch
-
Statement type: