nthlayer-workers 3.0.10__tar.gz → 4.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/PKG-INFO +2 -2
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/pyproject.toml +2 -2
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/prometheus.py +5 -3
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/summary.py +8 -2
- nthlayer_workers-4.0.1/src/nthlayer_workers/llm_provider.py +33 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/prometheus.py +19 -5
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/pipeline/router.py +3 -3
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/store/sqlite.py +7 -5
- nthlayer_workers-4.0.1/src/nthlayer_workers/measure/telemetry.py +163 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/drift/analyzer.py +2 -1
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/base.py +2 -1
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/PKG-INFO +2 -2
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/SOURCES.txt +2 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/requires.txt +1 -1
- nthlayer_workers-4.0.1/tests/test_llm_provider.py +38 -0
- nthlayer_workers-3.0.10/src/nthlayer_workers/measure/telemetry.py +0 -116
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/LICENSE +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/README.md +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/setup.cfg +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/cli.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/cli_output.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/cli.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/config.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/correlation/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/correlation/changes.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/correlation/dedup.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/correlation/engine.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/correlation/temporal.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/correlation/topology.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/ingestion/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/ingestion/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/ingestion/severity.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/ingestion/webhook.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/notifications.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/reasoning.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/session.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/snapshot/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/snapshot/generator.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/snapshot/model.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/snapshot/token.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/state.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/store/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/store/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/store/sqlite.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/traces/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/traces/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/traces/tempo.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/traces/topology.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/types.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/verdict_chain.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/worker.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/__main__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_apply.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_gh.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_interactive.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_interactive_app.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_preview.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_trigger.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/_yaml.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/cli.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/recommendations.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/retrospective.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/trends.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/learn/worker.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/__main__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/_parsing.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/_util.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/devin.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/gastown.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/adapters/webhook.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/calibration/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/calibration/loop.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/calibration/slos.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/calibration/verdict_calibration.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/cli.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/config.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/detection/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/detection/detector.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/detection/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/governance/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/governance/engine.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/manifest.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/notifications.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/pipeline/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/pipeline/evaluator.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/store/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/store/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/thresholds/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/thresholds/phase.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/thresholds/sampler.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/thresholds/state.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/tiering/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/tiering/classifier.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/tiering/promotion.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/trends/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/trends/tracker.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/types.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/worker.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/__main__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/api/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/assessment.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/cli.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/config.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/db/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/decision_records.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/discovery.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/backstage.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/base.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/consul.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/etcd.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/kubernetes.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/prometheus.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/dependencies/providers/zookeeper.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/deployments/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/discovery/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/discovery/classifier.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/discovery/client.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/discovery/models.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/drift/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/drift/models.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/drift/patterns.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/explanation.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/gate/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/gate/conditions.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/gate/correlator.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/gate/evaluator.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/gate/policies.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/gate_adapter.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/incident.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/portfolio/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/portfolio/aggregator.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/portfolio/scorer.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/slo/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/slo/collector.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/slo/spec_loader.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/sqlite_store.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/store.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/verification/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/verification/exporter_guidance.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/verification/extractor.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/verification/models.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/verification/verifier.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/worker.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/__main__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/communication.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/investigation.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/remediation.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/response_models.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/triage.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/cli.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/config.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/context_store.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/coordinator.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/metrics.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/notification_backends/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/notification_backends/ntfy_backend.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/notification_backends/protocol.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/notification_backends/slack_backend.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/notification_backends/stdout_backend.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/notifications.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/oncall/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/oncall/escalation.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/oncall/runner.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/oncall/schedule.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/safe_actions/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/safe_actions/actions.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/safe_actions/registry.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/safe_actions/webhook.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/server.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/sre/__init__.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/sre/brief.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/sre/delegation.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/sre/post_incident.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/sre/shift_report.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/sre/suppression.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/types.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/verdict_submission.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/worker.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/worker_helpers.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/runner.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/dependency_links.txt +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/entry_points.txt +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/top_level.txt +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/tests/test_cli_gate.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/tests/test_dependency_declarations.py +0 -0
- {nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/tests/test_runner.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nthlayer-workers
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: NthLayer workers — Tier 2 background computation (observe, measure, correlate, respond, learn)
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
|
-
Requires-Dist: nthlayer-common<6.0.0,>=5.
|
|
9
|
+
Requires-Dist: nthlayer-common<6.0.0,>=5.10.0
|
|
10
10
|
Requires-Dist: httpx>=0.27
|
|
11
11
|
Requires-Dist: pyyaml>=6.0
|
|
12
12
|
Requires-Dist: structlog>=24.1.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "nthlayer-workers"
|
|
7
|
-
version = "
|
|
7
|
+
version = "4.0.1"
|
|
8
8
|
description = "NthLayer workers — Tier 2 background computation (observe, measure, correlate, respond, learn)"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = {text = "Apache-2.0"}
|
|
@@ -56,7 +56,7 @@ dependencies = [
|
|
|
56
56
|
# nthlayer-common's evaluate_threshold (CORE §5.5.6) and read from core 3.0's
|
|
57
57
|
# /manifests via threshold_from_v2_entry; error magnitudes are no longer
|
|
58
58
|
# SLOs (decision 3c, common 4.0/5.0). See nthlayer-common/docs/upgrading-5.0.md.
|
|
59
|
-
"nthlayer-common>=5.
|
|
59
|
+
"nthlayer-common>=5.10.0,<6.0.0",
|
|
60
60
|
"httpx>=0.27",
|
|
61
61
|
"pyyaml>=6.0",
|
|
62
62
|
"structlog>=24.1.0",
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/prometheus.py
RENAMED
|
@@ -6,6 +6,7 @@ from datetime import UTC, datetime
|
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
import structlog
|
|
9
|
+
from nthlayer_common.manifest import ERROR_BUDGET_REMAINING
|
|
9
10
|
|
|
10
11
|
from nthlayer_workers.correlate.types import EventType, SitRepEvent
|
|
11
12
|
|
|
@@ -60,10 +61,11 @@ async def fetch_metric_breaches(
|
|
|
60
61
|
now = datetime.now(UTC)
|
|
61
62
|
|
|
62
63
|
for service in services:
|
|
63
|
-
# Check error budget
|
|
64
|
+
# Check error budget: the worst across the service's SLOs, since
|
|
65
|
+
# generate writes one series per availability SLO (opensrm-h0at).
|
|
64
66
|
budget = await _query_instant(
|
|
65
67
|
client, prometheus_url,
|
|
66
|
-
f
|
|
68
|
+
f"min({ERROR_BUDGET_REMAINING.selector(service=service)})",
|
|
67
69
|
)
|
|
68
70
|
if budget is not None and budget < 0.0:
|
|
69
71
|
events.append(SitRepEvent(
|
|
@@ -75,7 +77,7 @@ async def fetch_metric_breaches(
|
|
|
75
77
|
environment="production",
|
|
76
78
|
severity=min(1.0, abs(budget) * 5), # 20% deficit → severity 1.0
|
|
77
79
|
payload={
|
|
78
|
-
"metric":
|
|
80
|
+
"metric": ERROR_BUDGET_REMAINING.metric,
|
|
79
81
|
"value": budget,
|
|
80
82
|
"breach": "error_budget_exhausted",
|
|
81
83
|
},
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/summary.py
RENAMED
|
@@ -151,7 +151,11 @@ def _select_sample_events(events: list[SitRepEvent], max_samples: int = 10) -> l
|
|
|
151
151
|
def _record_failure(error: Exception, snapshot_service: str, model: str | None = None) -> None:
|
|
152
152
|
"""Record summary generation failure via logging + metrics."""
|
|
153
153
|
reason = _classify_failure(error)
|
|
154
|
-
|
|
154
|
+
# No model means the call used nthlayer-common's default; report that
|
|
155
|
+
# model, so the provider can be derived from it (opensrm-ju8r J4).
|
|
156
|
+
from nthlayer_common.llm import DEFAULT_MODEL
|
|
157
|
+
|
|
158
|
+
resolved_model = model or DEFAULT_MODEL
|
|
155
159
|
logger.warning(
|
|
156
160
|
"correlate_summary_failed",
|
|
157
161
|
reason=reason,
|
|
@@ -165,9 +169,11 @@ def _record_failure(error: Exception, snapshot_service: str, model: str | None =
|
|
|
165
169
|
pass # metrics infra may not be configured
|
|
166
170
|
try:
|
|
167
171
|
from nthlayer_common.telemetry import emit_llm_event
|
|
172
|
+
|
|
173
|
+
from nthlayer_workers.llm_provider import provider_for_model
|
|
168
174
|
emit_llm_event(
|
|
169
175
|
model=resolved_model,
|
|
170
|
-
provider=
|
|
176
|
+
provider=provider_for_model(resolved_model),
|
|
171
177
|
caller="correlate.generate_summary",
|
|
172
178
|
success=False,
|
|
173
179
|
error=str(error),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""The provider an LLM call is reported against (opensrm-ju8r, ruling J4).
|
|
2
|
+
|
|
3
|
+
OpenSRM Addendum A1 §5 P4 identifies the provider by ``gen_ai.provider.name``.
|
|
4
|
+
Workers knows only the model string it called, so it derives the provider
|
|
5
|
+
from that: an explicit ``provider/`` prefix wins; otherwise only the model
|
|
6
|
+
families whose provider is unambiguous are mapped. Anything else is reported
|
|
7
|
+
as ``"unknown"`` rather than guessed (nthlayer-common's ``_guess_provider``
|
|
8
|
+
defaults to ``openai``, which would be a confident wrong answer here).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from __future__ import annotations
|
|
12
|
+
|
|
13
|
+
UNKNOWN_PROVIDER = "unknown"
|
|
14
|
+
|
|
15
|
+
# Bare-model prefixes whose provider is not in doubt. Add a family here only
|
|
16
|
+
# when its prefix cannot belong to another provider; otherwise it stays unknown.
|
|
17
|
+
_FAMILY_PREFIXES: tuple[tuple[str, str], ...] = (
|
|
18
|
+
("claude", "anthropic"),
|
|
19
|
+
("gpt", "openai"),
|
|
20
|
+
("o1", "openai"),
|
|
21
|
+
("o3", "openai"),
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def provider_for_model(model: str) -> str:
|
|
26
|
+
"""Return the ``gen_ai.provider.name`` value for *model*."""
|
|
27
|
+
if "/" in model:
|
|
28
|
+
prefix = model.split("/", 1)[0]
|
|
29
|
+
return prefix or UNKNOWN_PROVIDER
|
|
30
|
+
for prefix, provider in _FAMILY_PREFIXES:
|
|
31
|
+
if model.startswith(prefix):
|
|
32
|
+
return provider
|
|
33
|
+
return UNKNOWN_PROVIDER
|
|
@@ -8,6 +8,7 @@ from typing import Any
|
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
10
10
|
from nthlayer_common.manifest import (
|
|
11
|
+
ERROR_BUDGET_REMAINING,
|
|
11
12
|
ManifestLoadError,
|
|
12
13
|
foreign_yaml_reason,
|
|
13
14
|
iter_manifest_files,
|
|
@@ -120,7 +121,7 @@ def load_specs(specs_dir: Path) -> LoadedSpecs:
|
|
|
120
121
|
# Deliberately NOT slo.indicator_query. evaluate_slos' branches
|
|
121
122
|
# are hard-coded to the semantics of the synthesised queries:
|
|
122
123
|
# availability breaches on `current < 0.0`, meaningful only for
|
|
123
|
-
#
|
|
124
|
+
# the error-budget series, and judgment inverts, right only for
|
|
124
125
|
# the overrides/decisions RATIO. A manifest's own query supplies
|
|
125
126
|
# an SLI instead, which would make availability unbreachable and
|
|
126
127
|
# double-invert judgment. Query and breach rule travel together.
|
|
@@ -148,7 +149,8 @@ def _query_for(service: str, slo: ManifestSLO) -> tuple[str, str]:
|
|
|
148
149
|
a good-ratio SLI, seconds, or a signed error budget. Deriving it later
|
|
149
150
|
from the SLO's name or type cannot work — that is precisely what broke.
|
|
150
151
|
|
|
151
|
-
Judgment SLOs get the interim raw-metric queries below.
|
|
152
|
+
Judgment SLOs get the interim raw-metric queries below. Availability-typed
|
|
153
|
+
classical SLOs read the error budget generate writes; everything else
|
|
152
154
|
falls back to the recording-rule convention. Always returns a query: an
|
|
153
155
|
SLO reaching evaluation with none would be dropped silently.
|
|
154
156
|
"""
|
|
@@ -163,8 +165,20 @@ def _query_for(service: str, slo: ManifestSLO) -> tuple[str, str]:
|
|
|
163
165
|
if builder is not None:
|
|
164
166
|
kind = _JUDGMENT_QUERY_KINDS[slo.judgment_type]
|
|
165
167
|
return builder(service, slo.window or "7d"), kind
|
|
166
|
-
if
|
|
167
|
-
|
|
168
|
+
if not slo.judgment_type and "availability" in (slo.slo_type or name).lower():
|
|
169
|
+
# The right-hand test is generate's, verbatim (manifest_builder.py
|
|
170
|
+
# `_build_standard_slo_rules`): keyed by type, falling back to the
|
|
171
|
+
# name only when no type is set. Substring and lower() because srm/v1
|
|
172
|
+
# and legacy pass an explicit `type:` through unnormalised (opensrm-hiw2). The
|
|
173
|
+
# left-hand `not judgment_type` stands in for generate only ever
|
|
174
|
+
# passing classical SLOs there; judgment SLOs are availability-shaped
|
|
175
|
+
# too, and one with no builder above keeps the fallback below. The
|
|
176
|
+
# selector filters to this SLO, as each series carries slo=<name>
|
|
177
|
+
# (opensrm-h0at).
|
|
178
|
+
return (
|
|
179
|
+
ERROR_BUDGET_REMAINING.selector(service=service, slo=name),
|
|
180
|
+
"error_budget",
|
|
181
|
+
)
|
|
168
182
|
if name == "latency":
|
|
169
183
|
percentile = slo.percentile or "p99"
|
|
170
184
|
return (
|
|
@@ -416,7 +430,7 @@ async def evaluate_slos(
|
|
|
416
430
|
sli_pct = (1.0 - current_value) * 100
|
|
417
431
|
raw_breach = sli_pct < slo.target
|
|
418
432
|
elif slo.query_kind == "error_budget":
|
|
419
|
-
#
|
|
433
|
+
# The error budget is signed — negative is overspent.
|
|
420
434
|
# The target is not consulted; it is baked into the rule.
|
|
421
435
|
raw_breach = current_value < 0.0
|
|
422
436
|
elif slo.query_kind == "latency_seconds":
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/pipeline/router.py
RENAMED
|
@@ -14,7 +14,7 @@ from nthlayer_workers.measure.detection.protocol import DegradationDetector
|
|
|
14
14
|
from nthlayer_workers.measure.governance.engine import GovernanceEngine
|
|
15
15
|
from nthlayer_workers.measure.pipeline.evaluator import Evaluator
|
|
16
16
|
from nthlayer_workers.measure.store.protocol import ScoreStore
|
|
17
|
-
from nthlayer_workers.measure.telemetry import
|
|
17
|
+
from nthlayer_workers.measure.telemetry import emit_evaluation_events
|
|
18
18
|
from nthlayer_workers.measure.tiering.classifier import TierClassifier
|
|
19
19
|
from nthlayer_workers.measure.trends.tracker import TrendTracker
|
|
20
20
|
from nthlayer_workers.measure.types import QualityScore
|
|
@@ -82,7 +82,7 @@ class PipelineRouter:
|
|
|
82
82
|
auto_approved=True,
|
|
83
83
|
)
|
|
84
84
|
await self._store.save_score(auto_score)
|
|
85
|
-
|
|
85
|
+
emit_evaluation_events(auto_score, None)
|
|
86
86
|
continue
|
|
87
87
|
|
|
88
88
|
# Model routing for non-minimal tiers (or sampled minimal)
|
|
@@ -117,7 +117,7 @@ class PipelineRouter:
|
|
|
117
117
|
)
|
|
118
118
|
alerts = self._detector.check(window)
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
emit_evaluation_events(score, alerts)
|
|
121
121
|
|
|
122
122
|
if self._governance is not None:
|
|
123
123
|
await self._governance.check_agent(output.agent_name)
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/measure/store/sqlite.py
RENAMED
|
@@ -11,7 +11,7 @@ from pathlib import Path
|
|
|
11
11
|
|
|
12
12
|
from nthlayer_common.verdicts import VerdictStore as VerdictStoreBase
|
|
13
13
|
|
|
14
|
-
from nthlayer_workers.measure.telemetry import
|
|
14
|
+
from nthlayer_workers.measure.telemetry import emit_correction_event, emit_state_transition_event
|
|
15
15
|
from nthlayer_workers.measure.types import QualityScore
|
|
16
16
|
|
|
17
17
|
_SCHEMA_PATH = Path(__file__).parent / "schema.sql"
|
|
@@ -155,10 +155,10 @@ class SQLiteScoreStore:
|
|
|
155
155
|
verdict_id = None
|
|
156
156
|
with self._lock:
|
|
157
157
|
# Verify eval_id exists
|
|
158
|
-
|
|
159
|
-
"SELECT
|
|
158
|
+
eval_row = self._conn.execute(
|
|
159
|
+
"SELECT task_id FROM evaluations WHERE eval_id = ?", (eval_id,)
|
|
160
160
|
).fetchone()
|
|
161
|
-
if not
|
|
161
|
+
if not eval_row:
|
|
162
162
|
raise ValueError(
|
|
163
163
|
f"Cannot override non-existent evaluation: {eval_id}"
|
|
164
164
|
)
|
|
@@ -183,9 +183,11 @@ class SQLiteScoreStore:
|
|
|
183
183
|
corrector,
|
|
184
184
|
),
|
|
185
185
|
)
|
|
186
|
-
|
|
186
|
+
emit_correction_event(
|
|
187
187
|
eval_id, dim_name, original_score,
|
|
188
188
|
corrected_score, corrector,
|
|
189
|
+
# The evaluated task is the decision the correction is about.
|
|
190
|
+
decision_id=eval_row["task_id"],
|
|
189
191
|
)
|
|
190
192
|
self._conn.commit()
|
|
191
193
|
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""OTel instrumentation — records facts as events, never evaluates quality (ZFC).
|
|
2
|
+
|
|
3
|
+
Gracefully no-ops if opentelemetry is not installed.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from nthlayer_workers.measure.detection.protocol import Alert
|
|
12
|
+
from nthlayer_workers.measure.types import QualityScore
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from opentelemetry import trace
|
|
16
|
+
|
|
17
|
+
_tracer = trace.get_tracer("nthlayer-measure")
|
|
18
|
+
_HAS_OTEL = True
|
|
19
|
+
except ImportError:
|
|
20
|
+
_tracer = None # type: ignore[assignment]
|
|
21
|
+
_HAS_OTEL = False
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
# OpenSRM Addendum A1 (opensrm-ju8r). Measure's scores are grader evaluations,
|
|
25
|
+
# emitted as the upstream grader event (A1 §4.4). The other events here are
|
|
26
|
+
# nthlayer.* implementation events: A1 does not define them, and A1 §4.0 bars
|
|
27
|
+
# gen_ai.* names for anything OpenSRM-defined or our own. The calibration and
|
|
28
|
+
# autonomy events only had their names changed: their attributes stay bare
|
|
29
|
+
# (agent_name, from_level), unlike the namespaced grader attributes.
|
|
30
|
+
GRADER_EVENT = "gen_ai.evaluation.result"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def emit_evaluation_events(score: QualityScore, alerts: list[Alert] | None = None) -> None:
|
|
34
|
+
"""Record an evaluation: one grader event per dimension, plus a summary.
|
|
35
|
+
|
|
36
|
+
Each dimension score is a ``gen_ai.evaluation.result`` about the evaluated
|
|
37
|
+
task's decision, with ``nthlayer.evaluator.kind`` ``implementation``
|
|
38
|
+
(NthLayer's evaluator, vs ``human`` in ``emit_correction_event``). Per-evaluation facts
|
|
39
|
+
(cost, alerts, dimension count) go on one ``nthlayer.evaluation.completed``
|
|
40
|
+
event instead, so they are not repeated, and summed, once per dimension.
|
|
41
|
+
|
|
42
|
+
An auto-approved output emits the summary only: no evaluator ran, so its
|
|
43
|
+
configured scores are nobody's opinion and must not reach grader
|
|
44
|
+
consumers (A1 §3).
|
|
45
|
+
"""
|
|
46
|
+
if not _HAS_OTEL:
|
|
47
|
+
return
|
|
48
|
+
span = trace.get_current_span()
|
|
49
|
+
# A1 §4.4: nthlayer.decision.id only when the decision is identifiable;
|
|
50
|
+
# some adapters leave task_id empty.
|
|
51
|
+
decision_attrs: dict[str, str] = (
|
|
52
|
+
{"nthlayer.decision.id": score.task_id} if score.task_id else {}
|
|
53
|
+
)
|
|
54
|
+
if not score.auto_approved:
|
|
55
|
+
for dimension, value in score.dimensions.items():
|
|
56
|
+
span.add_event(
|
|
57
|
+
GRADER_EVENT,
|
|
58
|
+
attributes={
|
|
59
|
+
**decision_attrs,
|
|
60
|
+
"gen_ai.evaluation.name": dimension,
|
|
61
|
+
"gen_ai.evaluation.score.value": value,
|
|
62
|
+
"nthlayer.evaluator.kind": "implementation",
|
|
63
|
+
"gen_ai.agent.name": score.agent_name,
|
|
64
|
+
"nthlayer.evaluation.id": score.eval_id,
|
|
65
|
+
"nthlayer.evaluator.model": score.evaluator_model,
|
|
66
|
+
"nthlayer.evaluator.confidence": score.confidence,
|
|
67
|
+
},
|
|
68
|
+
)
|
|
69
|
+
summary: dict[str, str | float | int | bool] = {
|
|
70
|
+
**decision_attrs,
|
|
71
|
+
"nthlayer.evaluation.id": score.eval_id,
|
|
72
|
+
"gen_ai.agent.name": score.agent_name,
|
|
73
|
+
"nthlayer.evaluation.dimension_count": len(score.dimensions),
|
|
74
|
+
"nthlayer.evaluation.auto_approved": score.auto_approved,
|
|
75
|
+
}
|
|
76
|
+
if score.cost_usd is not None:
|
|
77
|
+
summary["nthlayer.evaluation.cost_usd"] = score.cost_usd
|
|
78
|
+
if alerts:
|
|
79
|
+
summary["nthlayer.evaluation.alert_count"] = len(alerts)
|
|
80
|
+
span.add_event("nthlayer.evaluation.completed", attributes=summary)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def emit_correction_event(
|
|
84
|
+
eval_id: str,
|
|
85
|
+
dimension: str,
|
|
86
|
+
original: float,
|
|
87
|
+
corrected: float,
|
|
88
|
+
corrector: str,
|
|
89
|
+
*,
|
|
90
|
+
decision_id: str | None = None,
|
|
91
|
+
) -> None:
|
|
92
|
+
"""Record a human's corrected dimension score as a human grader evaluation.
|
|
93
|
+
|
|
94
|
+
A1 §4.4: a human's verdict on a completion is a grader evaluation with
|
|
95
|
+
``nthlayer.evaluator.kind`` ``human``. ``decision_id`` is the evaluated
|
|
96
|
+
task; it is omitted when unknown or empty.
|
|
97
|
+
"""
|
|
98
|
+
if not _HAS_OTEL:
|
|
99
|
+
return
|
|
100
|
+
span = trace.get_current_span()
|
|
101
|
+
attributes: dict[str, str | float | int | bool] = {
|
|
102
|
+
"gen_ai.evaluation.name": dimension,
|
|
103
|
+
"gen_ai.evaluation.score.value": corrected,
|
|
104
|
+
"nthlayer.evaluator.kind": "human",
|
|
105
|
+
"nthlayer.evaluation.id": eval_id,
|
|
106
|
+
"nthlayer.evaluation.original_score": original,
|
|
107
|
+
"nthlayer.evaluator.actor": corrector,
|
|
108
|
+
}
|
|
109
|
+
if decision_id:
|
|
110
|
+
attributes["nthlayer.decision.id"] = decision_id
|
|
111
|
+
span.add_event(GRADER_EVENT, attributes=attributes)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
def emit_calibration_report_event(
|
|
115
|
+
agent_name: str,
|
|
116
|
+
window_days: int,
|
|
117
|
+
reversal_rate: float,
|
|
118
|
+
false_accept_rate: float | None,
|
|
119
|
+
precision: float | None,
|
|
120
|
+
recall: float | None,
|
|
121
|
+
mae: float,
|
|
122
|
+
compliant: bool | None = None,
|
|
123
|
+
) -> None:
|
|
124
|
+
"""Record a calibration/SLO report as a span event."""
|
|
125
|
+
if not _HAS_OTEL:
|
|
126
|
+
return
|
|
127
|
+
span = trace.get_current_span()
|
|
128
|
+
attributes: dict[str, str | float | int | bool] = {
|
|
129
|
+
"agent_name": agent_name,
|
|
130
|
+
"window_days": window_days,
|
|
131
|
+
"reversal_rate": reversal_rate,
|
|
132
|
+
"mae": mae,
|
|
133
|
+
}
|
|
134
|
+
if false_accept_rate is not None:
|
|
135
|
+
attributes["false_accept_rate"] = false_accept_rate
|
|
136
|
+
if precision is not None:
|
|
137
|
+
attributes["precision"] = precision
|
|
138
|
+
if recall is not None:
|
|
139
|
+
attributes["recall"] = recall
|
|
140
|
+
if compliant is not None:
|
|
141
|
+
attributes["reversal_rate_compliant"] = compliant
|
|
142
|
+
span.add_event("nthlayer.calibration.report", attributes=attributes)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def emit_state_transition_event(
|
|
146
|
+
agent_name: str,
|
|
147
|
+
from_level: str,
|
|
148
|
+
to_level: str,
|
|
149
|
+
triggered_by: str,
|
|
150
|
+
) -> None:
|
|
151
|
+
"""Record an autonomy state transition as a span event."""
|
|
152
|
+
if not _HAS_OTEL:
|
|
153
|
+
return
|
|
154
|
+
span = trace.get_current_span()
|
|
155
|
+
span.add_event(
|
|
156
|
+
"nthlayer.autonomy.changed",
|
|
157
|
+
attributes={
|
|
158
|
+
"agent_name": agent_name,
|
|
159
|
+
"from_level": from_level,
|
|
160
|
+
"to_level": to_level,
|
|
161
|
+
"triggered_by": triggered_by,
|
|
162
|
+
},
|
|
163
|
+
)
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/observe/drift/analyzer.py
RENAMED
|
@@ -12,6 +12,7 @@ from datetime import UTC, datetime, timedelta
|
|
|
12
12
|
from typing import Any
|
|
13
13
|
|
|
14
14
|
import numpy as np
|
|
15
|
+
from nthlayer_common.manifest import ERROR_BUDGET_REMAINING
|
|
15
16
|
from scipy import stats
|
|
16
17
|
|
|
17
18
|
from nthlayer_workers.observe.drift.models import (
|
|
@@ -159,7 +160,7 @@ class DriftAnalyzer:
|
|
|
159
160
|
"""Query error budget over time window."""
|
|
160
161
|
import httpx
|
|
161
162
|
|
|
162
|
-
query =
|
|
163
|
+
query = ERROR_BUDGET_REMAINING.selector(service=service, slo=slo)
|
|
163
164
|
|
|
164
165
|
end = datetime.now(UTC)
|
|
165
166
|
start = end - self._parse_duration(window)
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/respond/agents/base.py
RENAMED
|
@@ -16,6 +16,7 @@ from nthlayer_common.telemetry import emit_llm_event
|
|
|
16
16
|
from nthlayer_common.verdicts import Verdict
|
|
17
17
|
from nthlayer_common.verdicts import create as verdict_create
|
|
18
18
|
|
|
19
|
+
from nthlayer_workers.llm_provider import provider_for_model
|
|
19
20
|
from nthlayer_workers.respond.types import AgentRole, IncidentContext
|
|
20
21
|
|
|
21
22
|
log = structlog.get_logger(__name__)
|
|
@@ -111,7 +112,7 @@ class AgentBase(ABC):
|
|
|
111
112
|
existing ``parse_response`` (which accepts a JSON string and
|
|
112
113
|
produces a dataclass result) can be reused without rewrite.
|
|
113
114
|
"""
|
|
114
|
-
provider = self._model
|
|
115
|
+
provider = provider_for_model(self._model)
|
|
115
116
|
caller = f"respond.{self.role.value}"
|
|
116
117
|
try:
|
|
117
118
|
result = await asyncio.wait_for(
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nthlayer-workers
|
|
3
|
-
Version:
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: NthLayer workers — Tier 2 background computation (observe, measure, correlate, respond, learn)
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Requires-Python: >=3.11
|
|
7
7
|
Description-Content-Type: text/markdown
|
|
8
8
|
License-File: LICENSE
|
|
9
|
-
Requires-Dist: nthlayer-common<6.0.0,>=5.
|
|
9
|
+
Requires-Dist: nthlayer-common<6.0.0,>=5.10.0
|
|
10
10
|
Requires-Dist: httpx>=0.27
|
|
11
11
|
Requires-Dist: pyyaml>=6.0
|
|
12
12
|
Requires-Dist: structlog>=24.1.0
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers.egg-info/SOURCES.txt
RENAMED
|
@@ -4,6 +4,7 @@ pyproject.toml
|
|
|
4
4
|
src/nthlayer_workers/__init__.py
|
|
5
5
|
src/nthlayer_workers/cli.py
|
|
6
6
|
src/nthlayer_workers/cli_output.py
|
|
7
|
+
src/nthlayer_workers/llm_provider.py
|
|
7
8
|
src/nthlayer_workers/runner.py
|
|
8
9
|
src/nthlayer_workers.egg-info/PKG-INFO
|
|
9
10
|
src/nthlayer_workers.egg-info/SOURCES.txt
|
|
@@ -189,4 +190,5 @@ src/nthlayer_workers/respond/sre/shift_report.py
|
|
|
189
190
|
src/nthlayer_workers/respond/sre/suppression.py
|
|
190
191
|
tests/test_cli_gate.py
|
|
191
192
|
tests/test_dependency_declarations.py
|
|
193
|
+
tests/test_llm_provider.py
|
|
192
194
|
tests/test_runner.py
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""provider_for_model: the gen_ai.provider.name workers reports (opensrm-ju8r J4).
|
|
2
|
+
|
|
3
|
+
OpenSRM Addendum A1 §5 P4 names the provider by gen_ai.provider.name, whose
|
|
4
|
+
upstream well-known values include "anthropic" and "openai". Workers used to
|
|
5
|
+
send the sentinel "unknown" whenever a model string carried no
|
|
6
|
+
"provider/" prefix, so a bare Claude model was reported as an unknown provider.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import pytest
|
|
10
|
+
|
|
11
|
+
from nthlayer_workers.llm_provider import provider_for_model
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@pytest.mark.parametrize(
|
|
15
|
+
("model", "provider"),
|
|
16
|
+
[
|
|
17
|
+
# An explicit provider/ prefix is authoritative, whatever follows.
|
|
18
|
+
("anthropic/claude-sonnet-4-20250514", "anthropic"),
|
|
19
|
+
("openai/gpt-4o", "openai"),
|
|
20
|
+
("ollama/claude-lookalike", "ollama"),
|
|
21
|
+
# An empty prefix names nothing.
|
|
22
|
+
("/claude-sonnet", "unknown"),
|
|
23
|
+
# Bare model names from the two families whose provider is unambiguous.
|
|
24
|
+
("claude-sonnet-4-20250514", "anthropic"),
|
|
25
|
+
("gpt-4o", "openai"),
|
|
26
|
+
("o1-mini", "openai"),
|
|
27
|
+
("o3", "openai"),
|
|
28
|
+
# Nothing to go on: say so rather than guess.
|
|
29
|
+
# Not normalised: unrecognised spellings are unknown, not guessed.
|
|
30
|
+
("Claude-sonnet", "unknown"),
|
|
31
|
+
("anthropic.claude-3-sonnet", "unknown"),
|
|
32
|
+
("llama3", "unknown"),
|
|
33
|
+
("default", "unknown"),
|
|
34
|
+
("", "unknown"),
|
|
35
|
+
],
|
|
36
|
+
)
|
|
37
|
+
def test_provider_for_model(model: str, provider: str) -> None:
|
|
38
|
+
assert provider_for_model(model) == provider
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"""OTel instrumentation — records facts as events, never evaluates quality (ZFC).
|
|
2
|
-
|
|
3
|
-
Gracefully no-ops if opentelemetry is not installed.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
|
|
8
|
-
from typing import TYPE_CHECKING
|
|
9
|
-
|
|
10
|
-
if TYPE_CHECKING:
|
|
11
|
-
from nthlayer_workers.measure.detection.protocol import Alert
|
|
12
|
-
from nthlayer_workers.measure.types import QualityScore
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
from opentelemetry import trace
|
|
16
|
-
|
|
17
|
-
_tracer = trace.get_tracer("nthlayer-measure")
|
|
18
|
-
_HAS_OTEL = True
|
|
19
|
-
except ImportError:
|
|
20
|
-
_tracer = None # type: ignore[assignment]
|
|
21
|
-
_HAS_OTEL = False
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def emit_decision_event(score: QualityScore, alerts: list[Alert] | None = None) -> None:
|
|
25
|
-
"""Record an evaluation decision as a span event."""
|
|
26
|
-
if not _HAS_OTEL:
|
|
27
|
-
return
|
|
28
|
-
span = trace.get_current_span()
|
|
29
|
-
attributes: dict[str, str | float | int | bool] = {
|
|
30
|
-
"eval_id": score.eval_id,
|
|
31
|
-
"agent_name": score.agent_name,
|
|
32
|
-
"task_id": score.task_id,
|
|
33
|
-
"confidence": score.confidence,
|
|
34
|
-
"evaluator_model": score.evaluator_model,
|
|
35
|
-
"dimension_count": len(score.dimensions),
|
|
36
|
-
}
|
|
37
|
-
if score.cost_usd is not None:
|
|
38
|
-
attributes["cost_usd"] = score.cost_usd
|
|
39
|
-
if alerts:
|
|
40
|
-
attributes["alert_count"] = len(alerts)
|
|
41
|
-
span.add_event("gen_ai.decision.evaluated", attributes=attributes)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def emit_override_event(
|
|
45
|
-
eval_id: str,
|
|
46
|
-
dimension: str,
|
|
47
|
-
original: float,
|
|
48
|
-
corrected: float,
|
|
49
|
-
corrector: str,
|
|
50
|
-
) -> None:
|
|
51
|
-
"""Record a human override as a span event."""
|
|
52
|
-
if not _HAS_OTEL:
|
|
53
|
-
return
|
|
54
|
-
span = trace.get_current_span()
|
|
55
|
-
span.add_event(
|
|
56
|
-
"gen_ai.override.applied",
|
|
57
|
-
attributes={
|
|
58
|
-
"eval_id": eval_id,
|
|
59
|
-
"dimension": dimension,
|
|
60
|
-
"original_score": original,
|
|
61
|
-
"corrected_score": corrected,
|
|
62
|
-
"corrector": corrector,
|
|
63
|
-
},
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def emit_calibration_report_event(
|
|
68
|
-
agent_name: str,
|
|
69
|
-
window_days: int,
|
|
70
|
-
reversal_rate: float,
|
|
71
|
-
false_accept_rate: float | None,
|
|
72
|
-
precision: float | None,
|
|
73
|
-
recall: float | None,
|
|
74
|
-
mae: float,
|
|
75
|
-
compliant: bool | None = None,
|
|
76
|
-
) -> None:
|
|
77
|
-
"""Record a calibration/SLO report as a span event."""
|
|
78
|
-
if not _HAS_OTEL:
|
|
79
|
-
return
|
|
80
|
-
span = trace.get_current_span()
|
|
81
|
-
attributes: dict[str, str | float | int | bool] = {
|
|
82
|
-
"agent_name": agent_name,
|
|
83
|
-
"window_days": window_days,
|
|
84
|
-
"reversal_rate": reversal_rate,
|
|
85
|
-
"mae": mae,
|
|
86
|
-
}
|
|
87
|
-
if false_accept_rate is not None:
|
|
88
|
-
attributes["false_accept_rate"] = false_accept_rate
|
|
89
|
-
if precision is not None:
|
|
90
|
-
attributes["precision"] = precision
|
|
91
|
-
if recall is not None:
|
|
92
|
-
attributes["recall"] = recall
|
|
93
|
-
if compliant is not None:
|
|
94
|
-
attributes["reversal_rate_compliant"] = compliant
|
|
95
|
-
span.add_event("gen_ai.calibration.report", attributes=attributes)
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
def emit_state_transition_event(
|
|
99
|
-
agent_name: str,
|
|
100
|
-
from_level: str,
|
|
101
|
-
to_level: str,
|
|
102
|
-
triggered_by: str,
|
|
103
|
-
) -> None:
|
|
104
|
-
"""Record an autonomy state transition as a span event."""
|
|
105
|
-
if not _HAS_OTEL:
|
|
106
|
-
return
|
|
107
|
-
span = trace.get_current_span()
|
|
108
|
-
span.add_event(
|
|
109
|
-
"gen_ai.agent.state.changed",
|
|
110
|
-
attributes={
|
|
111
|
-
"agent_name": agent_name,
|
|
112
|
-
"from_level": from_level,
|
|
113
|
-
"to_level": to_level,
|
|
114
|
-
"triggered_by": triggered_by,
|
|
115
|
-
},
|
|
116
|
-
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nthlayer_workers-3.0.10 → nthlayer_workers-4.0.1}/src/nthlayer_workers/correlate/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|