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.5.1

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.5.1
File Size Uploaded Provenance Actions
ory_langchain-1.5.1.tar.gz 7.2 kB Without provenance Details for ory_langchain-1.5.1.tar.gz

Built distribution (wheel)

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

Total release size: 12.7 kB

Release files / ory_langchain-1.5.1.tar.gz

Download URL ory_langchain-1.5.1.tar.gz
Size 7.2 kB
Tags Source
SHA-256 checksum
How to use checksums
18e4e991dd3c2673c54264b4a8e87f7b6d8ab70a22b48671178a12c0f93d6ca6
BLAKE2b-256 checksum
How to use checksums
d051066ee2a8f8c01f846854a5e1d2687d2e5dae8b78dd4ef5b15d34b1163eac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","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.5.1-py3-none-any.whl

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

Security for ory-langchain 1.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.1 This release

2 release files No provenance

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