Skip to main content

ory-langchain

Ory Agent Security for LangChain / LangGraph.

Adds three things to a LangChain agent with one line:

  1. Authorization — every tool call is checked against Ory Permissions before it runs.
  2. Activity auditing — every invocation is recorded in the unified privacy-safe NDJSON log.
  3. Identity propagation — user → agent → sub-agent delegation, recorded in Ory.

Install

pip install ory-langchain

Use

from langchain.agents import create_agent
from ory_langchain import OryMiddleware

agent = create_agent(
    model,
    tools=[search, send_email],
    middleware=[OryMiddleware()],   # gate every tool call through Ory
)

OryMiddleware() reads the shared Ory config at ~/.config/ory-agent-plugins/config.json, so a login performed by any Ory coding-agent harness — or by ory-argus login — is reused transparently. Configure a project explicitly with OryMiddleware(project_url=...).

Permission mode

  • observe (default) — denied tools still run, but a permission.observe_deny activity event is recorded. Use this to see what would be blocked before enforcing.
  • enforce — denied tools are blocked: the model receives an error ToolMessage and the tool never executes. The posture is read from the Ory project — an admin promotes it to enforce in the Ory Console (Agent Security); ory-argus permissions shows what this machine resolves.

Activity only

If you only want lifecycle activity (no enforcement), use the callback handler instead:

from ory_langchain import OryCallbackHandler

agent.invoke({"messages": [...]}, config={"callbacks": [OryCallbackHandler()]})

Built on ory-argus, the shared Ory Agent Security core.

Download files

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

Source Distribution

ory_langchain-1.0.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

ory_langchain-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file ory_langchain-1.0.0.tar.gz.

File metadata

  • Download URL: ory_langchain-1.0.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ory_langchain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8f2fb971ab5208791997237d7607f3028897744cb945260184bcec05bc98fc02
MD5 7271fc9109bf0366a30ff77b940fa4c8
BLAKE2b-256 f4afbb148af90ed0f680fe2672f7313f01a3d0e9c5623f4fa2e70418ce4f4efc

See more details on using hashes here.

File details

Details for the file ory_langchain-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ory_langchain-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for ory_langchain-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 45a0fbe3ee5365e6932bc7dea54fb87236f5acb1f6143e2f62d996df4cd7a452
MD5 4656f583f53f049653ccdd10266cc757
BLAKE2b-256 f999d8e48790ffc614c9abe10dd9597e733e19661b644877dd381d2f5ab55b32

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.1

2 files

This release

1.0.0 This release

2 files

0.14.0

2 files

0.13.9

2 files

0.11.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page