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; on 0.2.2 you can disable it with 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.3.tar.gz (63.0 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.3-py3-none-any.whl (63.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: causalor-0.2.3.tar.gz
  • Upload date:
  • Size: 63.0 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.3.tar.gz
Algorithm Hash digest
SHA256 5dc6a710cd19de6456cf1d99dac35001d2eb93c03732f3840473e2cf2587af31
MD5 180cf372c1d5cd4fd6c2921cd324c92e
BLAKE2b-256 87ba775df5b30f0cc4f8d43afbe42b397d1fb34c138bfa43892a46b1cc2c042d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: causalor-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 63.5 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d91cb630b5ca1284c5ed2da2438cdb97394d6a14c7e301c4f517cb6360b43a2a
MD5 a839baff6752734212930ecb08c47ca9
BLAKE2b-256 b23e84791a7d517941e7c1609bd04f117afa3724d583aad2ab3538fa59b5da05

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