1. Install
2. Define an Alignment Card
The AIP SDK’s
card parameter is its own lightweight config type (AlignmentCard / AutonomyEnvelope / AlignmentCardValue) — it is not literally the full AAP unified card. If you already author an AAP card, translate its values.declared list into {name, priority, description} objects and pass autonomy.bounded_actions / forbidden_actions / escalation_triggers through as autonomy_envelope. Note the priority direction is inverted from AAP’s: lower number = higher priority here. If you deploy through the Mnemom gateway rather than the SDK directly, this translation happens for you server-side.Python
AlignmentCard, AlignmentCardValue, AutonomyEnvelope, and EscalationTrigger are dataclasses — construct them directly rather than passing a plain dict:
TypeScript
The TypeScript types are plain interfaces, so an object literal works directly:3. Check integrity
Create a client once, then callcheck() with the raw response body your agent’s own LLM call returned (the one containing the thinking block) — the client extracts the thinking block, builds the conscience prompt, calls the analysis LLM, and returns a signal. You do not extract or pass the thinking block yourself.
Python
Python
TypeScript
Unlike the Python dataclass, TypeScript’sWindowConfig fields are all required on the type — there is no constructor that fills in defaults for you, so spell them out (or import the individual DEFAULT_WINDOW_* constants):
Both SDKs also export the lower-level pure functions used internally (
check_integrity/checkIntegrity, build_signal/buildSignal, create_adapter_registry/createAdapterRegistry) if you need to build a custom pipeline. Most integrations should use create_client/createClient above — it wires window state, drift detection, and signal assembly together for you, and WindowManager is intentionally not part of the public API.4. Handle signals
signal from Step 3 already carries proceed and recommended_action — no need to re-derive them:
Verdict to action mapping
5. Extract thinking blocks from LLM responses
client.check() does this for you, but you can use the same provider adapters directly if you need to inspect extraction confidence or build a custom pipeline:
6. Add conscience values (optional)
Conscience values increase detection sensitivity for specific concerns:BOUNDARY and FEAR types are injected into the conscience prompt. BOUNDARY violations trigger boundary_violation verdicts. FEAR values increase sensitivity to specific concern patterns.
7. Detect drift
create_client/createClient already runs drift detection on every check() call and delivers alerts through the on_drift_alert callback (or signal.window_summary.drift_alert_active) — you only need the lower-level pieces below if you are managing checkpoints and the window yourself, outside the client:
WindowManager is part of the public Python API but is intentionally not exported from the TypeScript package — use createClient() there, which manages window state internally.Next steps
- Read the full specification for protocol details
- See the security model for the threat model
- See limitations for what AIP does and does not guarantee