ory-langchain
Ory Agent Security for LangChain / LangGraph.
Adds three things to a LangChain agent with one line:
- Authorization — every tool call is checked against Ory Permissions before it runs.
- Activity auditing — every invocation is recorded in the unified privacy-safe NDJSON log.
- 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 apermission.observe_denyactivity event is recorded. Use this to see what would be blocked before enforcing.enforce— denied tools are blocked: the model receives an errorToolMessageand 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 permissionsshows 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.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ory_langchain-1.2.3.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ory_langchain-1.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.5 kB
Release files / ory_langchain-1.2.3.tar.gz
| Download URL | ory_langchain-1.2.3.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6d973d0d1a2e247565000bf5b931a6579a9c7572168306f82af4fb56c8ce7d2
|
|
BLAKE2b-256 checksum How to use checksums |
9c62ce4f1113b100b1c88ca9a66375613607327a3710e5648e13a2d899b3cb56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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.2.3-py3-none-any.whl
| Download URL | ory_langchain-1.2.3-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2dd6705706693eda48fd78f25a8e675d096e43d7d9e01a25a00bde6388b27966
|
|
BLAKE2b-256 checksum How to use checksums |
4b8eda375854875afb2d8f91814a031de05842b5383c6a8e54e55ed8d1840bb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}
|