Skip to main content
Nothing needs configuring to get started. The settings below change where data goes, how the coding-agent hook runtime behaves and how strict the layers are.

Environment variables

The Python library and the TypeScript client read different sets of variables. Unless a row says otherwise, a variable is read by the Python library only.

Streaming

Both a token and a URL must be set for anything to attach. Details in Stream to Agentegrity Pro.

Hook runtime

Read by agentegrity hook and the per-session daemon that serve the Claude Code and Codex plugins. Set them where the host runs, since the daemon inherits the environment of the first hook call in a session. The daemon’s Unix socket lives in $XDG_RUNTIME_DIR/agentegrity-<uid>, or the system temp directory when XDG_RUNTIME_DIR is unset. If that directory is accessible to group or others, the runtime refuses the daemon and evaluates each call in-process instead, which does not stream.

Telemetry

Truthy values are 1, true, yes, on, t and y, case-insensitive. agentegrity.disable_telemetry() does the same at runtime. See Telemetry for every event.

Local model layer

Read only when you construct the opt-in model-backed layers. Constructor arguments (base_url=, model=, api_key=) take precedence over these variables.

Credential fingerprints

Treat this key like the credentials it fingerprints and use a separate key per tenant: two tenants sharing a key can join each other’s fingerprints. Rotating it invalidates every earlier fingerprint.

TypeScript client

Read by @agentegrity/client and every @agentegrity/<framework> package.

Entry point options

Every Python framework entry point accepts the same keyword options: hooks() in agentegrity.claude, run_hooks() in agentegrity.openai_agents, instrument_chain() and instrument_graph() in agentegrity.langchain, and instrument() in the CrewAI, Google ADK, AutoGen, Agno and Bedrock modules.
bool
default:"False"
When True, a block verdict denies the tool call, and an escalate verdict denies it unless an approval handler approves. When False, verdicts are recorded and nothing is blocked. The AutoGen adapter and Bedrock’s wrap_client observe only; they record the decision but cannot stop the call.
AgentProfile | None
default:"None"
The agent profile to evaluate. Defaults to AgentProfile.default(): a tool-using cloud agent at medium risk.
AgentegrityClient | None
default:"None"
A client whose evaluator the adapter uses. Build one to change thresholds, weights or the policy set.
Passing any of these options builds a new adapter instead of using the module’s default one. The module’s report(), register_exporter() and adapter() keep pointing at the default adapter, which then sees no events. To configure an adapter and still register exporters on it, create it from a client:
agentegrity.init() accepts name, frameworks, enforce, policy_set and profile, and passes enforce and the profile to every adapter it builds.

AgentegrityClient

The client builds the four default layers with these values. prefer_llm=True uses AdversarialLLMLayer and CorticalLLMLayer instead of their pattern-based parents, with api_key (or ANTHROPIC_API_KEY) as their key; see Model-backed layers. client.create_adapter(name, profile, *, enforce=False) returns an adapter for one of claude, langchain, openai_agents, crewai, google_adk, autogen, agno or bedrock_agents.

Adapter classes

To set a signing key or an approval handler, construct the adapter class directly. Every adapter class accepts:

Evaluator and layer options

Build an evaluator when the client’s options are not enough:

IntegrityEvaluator

AdversarialLayer

CorticalLayer

A reasoning conflict escalates regardless of these settings.

GovernanceLayer

RecoveryLayer

A broken attestation chain escalates.

Model-backed layers

AdversarialLLMLayer (agentegrity.layers.adversarial_llm) and CorticalLLMLayer (agentegrity.layers.cortical_llm) need pip install "agentegrity[llm]" and take api_key and model (default claude-haiku-4-5-20251001). AdversarialSLMLayer (agentegrity.layers.adversarial_slm) takes base_url, model, api_key, timeout (8.0) and max_tokens (256). All three accept the AdversarialLayer or CorticalLayer options of the layer they extend, and all fail open on errors. These layers call their model only on the async path: await layer.aevaluate(...), await evaluator.aevaluate(...) on an IntegrityEvaluator, or AsyncIntegrityEvaluator. Synchronous evaluate() runs only the pattern checks. default_layers(prefer_llm=True) and AgentegrityClient(prefer_llm=True) swap in both Claude-backed layers. Inside an adapter, the async path runs at every tool-call gate (pre_tool_use), the point where a verdict can stop the call. Other events (prompts, tool results, peer messages) stay on the sync, pattern-only path, and the text they add is classified at the next gate. Verdicts are cached by channel and content, so each piece of text is classified once. Only the adversarial classifiers call a model inside an adapter: CorticalLLMLayer checks the reasoning chain, memory reads and behavior descriptions, which adapters do not capture, so it skips its model calls there. Each gate waits for the classification. The Anthropic client retries a timed-out call twice, so one call can take about three times timeout (8 seconds by default) before the layer fails open, and a failed verdict is not cached, so during an outage every gate waits again. Async framework hooks await the check, so their event loop keeps running; sync hooks block their own thread. Other events are not held up: the adapter copies the context when the call arrives, classifies without holding its lock, and attests the verdict when the classification finishes, so with parallel tool calls a gate’s record can land after events that arrived while it was classifying.