Skip to main content
Three copy-paste blocks. Pick the one that matches your setup and run it.

1. Instrument an existing Claude Agent SDK agent

hooks() lazily builds a default adapter with a generic AgentProfile, the full four-layer evaluator (adversarial, cortical, governance, recovery), and measure-only semantics. It never blocks tool calls unless you pass enforce=True. report() returns a session summary: evaluation count, attestation chain length, whether the chain verifies.

1b. Instrument LangChain / LangGraph, OpenAI Agents, CrewAI, or Google ADK

Same shape, one import per framework. Pick the extra that matches your stack:
Each module exposes the same report() / reset() / adapter() surface as agentegrity.claude, with AgentProfile.default() and the full four-layer evaluator. Pass profile=, client=, or enforce=True to any of the entry points to override.

1c. Export session data to a dashboard or external sink

Every adapter exposes register_exporter(exporter). Subscribe anything that implements the SessionExporter protocol (on_session_start, on_event, on_session_end) and it receives live session data as JSON-ready dicts:
Exporter exceptions are caught and logged, so the exporter can never break the instrumented agent. For a production dashboard, use the Agentegrity Pro console and point the agent at it by setting AGENTEGRITY_EXPORTER_URL and AGENTEGRITY_TOKEN. The default adapter picks them up automatically and streams every session over the published exporter HTTP API. Non-Python agents use the same contract via one of the six TypeScript adapters, each shipping a 2–3 line zero-config enable. Pick the one that matches your framework:
Each re-exports registerExporter(), report(), and reset() for the same fan-out contract as the Python adapters. The low-level @agentegrity/client reporter is still available for custom frameworks. The wire format is published as JSON Schema in schemas/exporter/ and OpenAPI 3.1 in schemas/openapi.yaml, so any language can produce or consume events.

1d. Instrument a coding agent (Claude Code, Codex)

Coding agents run commands through one generic shell tool, so they are instrumented through their hook systems instead of a library call. Install the library for the python3 on your PATH, then the plugin for your host:
Each hook runs python3 -m agentegrity hook --host <host>, and one daemon per session keeps the full conversation in view. Piping a download into a shell or wiping logs is denied; sending data out after a secret was read asks on Claude Code and is denied on Codex. Set AGENTEGRITY_HOOK_MODE=alert to record verdicts without enforcing them, and verify a session afterwards:
See Claude Code and Codex for configuration and limits.

2. Score an arbitrary agent profile

Use this for one-off profile scoring, CI gates, or agents outside the Claude SDK.

3. Confidence test from the terminal

If doctor prints a composite score and OK, your install is wired correctly.

Next steps

  • Custom thresholds, layer weights, and threat detectors: drop down to IntegrityEvaluator and the individual layers (see Configuration).
  • Cryptographic attestation signing: pip install "agentegrity[crypto]" and call AttestationRecord.sign(private_key) to produce verifiable records.
  • LLM-backed cortical checks: pip install "agentegrity[llm]" and pass LLMCorticalCheck instances to CorticalLayer(llm_checks=[...]) for semantic reasoning-chain validation.
  • Governance policies: customize GovernanceLayer(policy_set=...) or register custom policy rules. See the governance layer spec.
  • Full specification: spec/SPECIFICATION.md is the source of truth for the property definitions, layer contracts, and scoring methodology.