Metadata-Version: 2.4
Name: algovoi-otel-genai
Version: 0.5.0
Summary: Map an AlgoVoi keystone decision to OpenTelemetry gen_ai.agent.* attributes, carrying execution_ref as an open recomputable cross-producer key (Apache-2.0)
Author-email: AlgoVoi <chopmob@gmail.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://www.algovoi.co.uk
Project-URL: Repository, https://github.com/chopmob-cloud/algovoi-keystone
Project-URL: Documentation, https://docs.algovoi.co.uk
Keywords: opentelemetry,otel,semantic-conventions,gen-ai,agent,authorization,execution_ref,jcs,rfc8785,algovoi
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: algovoi-substrate>=0.4.0
Requires-Dist: rfc8785>=0.1.4
Dynamic: license-file

# algovoi-otel-genai

Map an AlgoVoi keystone decision to OpenTelemetry `gen_ai.agent.*` attributes
(open-telemetry/semantic-conventions-genai), and attach `algovoi.keystone.execution_ref` as an
open, recomputable cross-producer key.

The standard `gen_ai.agent.*` trust/drift/scan attributes are producer-emitted and opaque. This
adapter emits them from a keystone decision and adds `execution_ref` =
`"sha256:" + SHA-256(JCS({decision_ref, action_type, scope, outcome, executed_at_ms}))`, which any
consumer recomputes from the span alone with only JCS (RFC 8785) + SHA-256. It binds the action to
the authorizing `decision_ref` (consistency, not just correlation).

```python
from algovoi_otel_genai import to_gen_ai_attributes, verify_gen_ai_execution_ref
attrs = to_gen_ai_attributes(decision_ref=dr, action_type="payment", scope="payments/transfer",
                             outcome="COMMITTED", executed_at_ms=1716460800000,
                             public_key_algorithm="ml-dsa-65",
                             trust={"score": 0.92, "method": "atb-v2"})
assert verify_gen_ai_execution_ref(attrs)   # recomputes execution_ref from the span, offline
```

Apache-2.0.
