Skip to main content

Causalor

Runtime governance for AI agents. Two layers of one control:

  • Block. pre_commit() checks a proposed action against typed constraints and refuses it before it executes, returning a proof of why. Runs in your process. No network call, no model call, no account.

    (Through 0.2.2 this also attempted a best-effort audit write to CLICKHOUSE_HOST, which defaulted to the bare hostname clickhouse. From 0.2.3 it is off unless you set that variable explicitly. If you are pinned to 0.2.2, set CAUSALOR_CH_AUDIT_ENABLED=false.)

  • Correct. track_action() reports what the agent did, and inject() returns a correction for its next turn when it has moved off policy, so the out-of-policy action is often never proposed. You do not diagnose the drift or write the fix.

pip install causalor

The published package is causalor. causalor-sdk is an internal development package and is not the one to install.

Block an action, without an account

This runs offline. No API key, no signup, no network call: the verdict is computed in your process from your state and your rule.

from causalor import Causalor, AgentStateSchema, FormalConstraint

schema = AgentStateSchema(version="1.0.0")
schema.register_field("refund_amt", "number")

c = Causalor(agent_id="refund-agent")
c.set_state_schema(schema)
c.register_constraints([FormalConstraint(
    constraint_id="refund_ceiling", variable="refund_amt",
    operator="<=", threshold=500, scope="SAFETY_CONSTRAINT",
)], replace=True)

# the agent decides to refund 900 against a 500 ceiling
result = c.pre_commit("customer-42", "issue_refund", state={"refund_amt": 900})

print(result.allowed)                    # False
print(result.proofs[0].proof_string)     # refund_amt=900 <= 500 -> False
print(result.state_snapshot_hash)
print(result.proofs[0].proof_fingerprint)

Output:

False
refund_amt=900 <= 500 -> False
sha256:v1:766ccc520ddeb830efe963d4b45434ab38e58dfd2ce41ffb28e59ad86d1e8586
sha256:v1:eb2c6c2242180923744ba837d376e58601bb02efeeebf60b57dc7aed754ba608

Those two hashes are not examples. Run the snippet and you will get the same values, on your machine, today or in a year, because the verdict is computed from the state and the rule rather than inferred by a model. If you get something else, that is a bug worth reporting.

(evaluated_at is a wall-clock timestamp and does change. The hashes do not.)

Correct drift while the agent is still reasoning

Correction needs the control plane, so three environment variables and nothing else:

CAUSALOR_API_KEY=cal_...                  # shown once on first login
CAUSALOR_API_URL=https://gw.causalorlabs.com
CAUSALOR_POLICY_ID=your-policy            # the policy you activated in the console
c = Causalor(agent_id="refund-agent")   # key, URL and telemetry read from env
c.load_policy_constraints_from_env()    # pull the guardrails you activated

c.track_action("customer-42", agent_action)   # session id first
correction = c.inject("customer-42")          # "" when nothing is wrong
if correction:
    prompt += correction

You can also start with nothing enforced: point a live agent at Causalor with no limits set and it reports where the agent drifted and which limits it would have crossed, on your real traffic, before you turn anything on.

API

Method Purpose
Causalor(agent_id=, api_url=, api_key=, tenant_id=) Key and URL fall back to the environment
set_state_schema(schema) Declare the fields rules may reference
register_constraints(constraints, replace=False) Register rules locally
load_policy_constraints_from_env(required=None) Pull the activated policy instead
pre_commit(user_id, action_name, state=) Check before the action runs
track_action(user_id, action_content) Report what the agent did
inject(user_id) Get a correction for the next turn
register_agent(agent_id, system_prompt, tools=) Report an off-path agent

pre_commit returns allowed, status, proofs, evaluated_constraints and state_snapshot_hash.

Three things that cause most integration bugs

  • track_action(user_id, action_content) takes the session id first. Passing the action text first silently breaks drift detection rather than erroring.
  • Do not configure OpenTelemetry. The SDK installs its own exporter from CAUSALOR_API_URL, and leaves an existing tracer provider alone if it finds one. Set CAUSALOR_AUTO_OTEL=false to opt out.
  • Do not call register(). Use register_agent(...).

Deployment routes

The same engine behind all three, so you can move between them without re-authoring anything:

  • In-process SDK, this package. Nothing in your model path.
  • Sidecar, one container in your VPC, so model traffic never leaves it.
  • Hosted gateway, point an OpenAI or Anthropic client base_url at https://gw.causalorlabs.com/v1.

Links

Blocking is free permanently, on every plan.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

causalor-0.2.4.tar.gz (62.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

causalor-0.2.4-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file causalor-0.2.4.tar.gz.

File metadata

  • Download URL: causalor-0.2.4.tar.gz
  • Upload date:
  • Size: 62.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for causalor-0.2.4.tar.gz
Algorithm Hash digest
SHA256 182ed5f29bd9fa3b8509da13d558ca88a798f6f2a2727eb90f3f186a0c1f275c
MD5 ef191d0159780407cd70a634c52b85ff
BLAKE2b-256 ac8e757d709951cb38362f286015367b50f234bab543f77517826e13d91b4c8f

See more details on using hashes here.

File details

Details for the file causalor-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: causalor-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 63.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for causalor-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5d1958218883c0b488779e88d5d223c877c3d488461b26b9b59607ca74d43c98
MD5 b4af1b8d4405c69396c288a80639cfc5
BLAKE2b-256 955833bffde3aa31c9e20444d1e4b53db5634491a966944afff60418f899eec1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page