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.

Metadata

Release files for ory-langchain 1.4.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ory-langchain 1.4.7
File Size Uploaded
ory_langchain-1.4.7.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ory-langchain 1.4.7
File Interpreter ABI Platform
ory_langchain-1.4.7-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / ory_langchain-1.4.7.tar.gz

Download URL ory_langchain-1.4.7.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d957ac49f8c66eb8c067ddbbf13bde6441e5fc75e02bbf161745b1e84ca9fa89
BLAKE2b-256 checksum
How to use checksums
5ca7b01a63229e6b1dce2a01065969e1f9048bf1452d6cd58c6010a6d0217ec1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}

Release files / ory_langchain-1.4.7-py3-none-any.whl

Download URL ory_langchain-1.4.7-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1cef40c77e58ce8765bbbaf27c9be87dddb4bca1f6432b6639f5e582802380e
BLAKE2b-256 checksum
How to use checksums
bf3096697b3299a54d63eb463adc7267dda115b92d6113016d3a94734929369c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.23 {"installer":{"name":"uv","version":"0.12.23","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}

Release history Release notifications | RSS feed

1.4.8

2 release files

This release

1.4.7 This release

2 release files

1.4.6

2 release files

1.4.5

2 release files

1.4.4

2 release files

1.4.3

2 release files

1.4.2

2 release files

1.4.1

2 release files

1.4.0

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.14.0

2 release files

0.13.9

2 release files

0.11.1

1 release 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