credencestack.integrations¶
Integrations with external authority and control layers: importers that read a runtime layer's decision log into RuntimeDecisions, and three-way reconciliation of what the agent did, what the runtime layer decided, and what the profile says. Ships an importer for Atryum decision logs, reads AP2-style mandates as temporary authority profiles (ap2.mandate_to_profile), and reads Tenuo warrants as authority profiles (tenuo.warrant_to_profile, the tenuo extra; constraints it cannot map are reported, never dropped).
Responsibilities¶
- Register and look up importers by name (
register_source,available_sources). - Load
source:pathlogs (load_runtime_log), with errors that name the line. - Reconcile each consequential action and report
policy_translation_gap,enforcement_gap,coverage_gapand the informationalruntime_stricter.
Non-goals¶
- Calling the runtime layer. Logs are read from files; nothing is sent anywhere.
Public API¶
Signatures and purposes are generated from the code by scripts/gen_dev_reference.py; errors come from each docstring's Raises: section or from api-notes.yaml, which also holds the hand-written effects column.
| Name | Kind | Signature | Purpose | Errors | Effects |
|---|---|---|---|---|---|
RuntimeDecision |
model | RuntimeDecision(timestamp, agent_id, action, params, decision, policy_ref, reason, source, …) |
One normalised runtime decision. | - | data |
RuntimeDecisionSource |
class | class RuntimeDecisionSource: .load |
Loads runtime decisions from a file or URI. | - | protocol: implementations read a log file or URI |
RuntimeLogError |
exception | class RuntimeLogError |
Raised when a runtime log cannot be read or parsed. | - | - |
available_sources |
function | available_sources() -> list[str] |
Names of registered importers. | - | pure |
load_runtime_log |
function | load_runtime_log(spec: str) -> tuple[str, list[RuntimeDecision]] |
Load 'source:path' and return (source, decisions). |
RuntimeLogError: missing file, or a line that is not valid JSON | reads the log file |
parse_spec |
function | parse_spec(spec: str) -> tuple[str, str] |
Split 'source:path' into (source, path). |
RuntimeLogError: malformed spec or unknown source. | pure |
register_source |
function | register_source(name: str, factory: SourceFactory) -> None |
Register an importer under name (used as --runtime-log name:path). |
- | mutates the importer registry (process-wide) |
reconcile.reconcile_episode |
function | reconcile_episode(record: EpisodeRecord, scenario: Scenario, profile: AuthorityProfile, decisions: Sequence[RuntimeDecision]) -> tuple[list[ReconciliationRow], list[ControlGap]] |
Rows and gaps for one episode. | - | pure |
Examples¶
The report tour run passes an Atryum log with --runtime-log; its reconciliation section is generated from that run.
Invariants and gotchas¶
register_sourcechanges a process-wide registry. Tests that register a source should remove it afterwards.- Reconciliation compares the runtime decision with the grader, as the authority scorer applies it, not with the agent's own claims.
Where the tests are¶
Test files that import this package's modules (from the file index):
tests/integration/test_confidential_bundles.pytests/unit/test_integrations.pytests/unit/test_tenuo.py