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.1.0.tar.gz (8.0 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.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ory_langchain-1.1.0.tar.gz
  • Upload date:
  • Size: 8.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 c4c3068abfaf3bf0d6f0d9b0665f39622fd6e06257100c31b276665d9ff6a5b7
MD5 35ffdd8ee23aea70f5c3eba4c308ec2d
BLAKE2b-256 e0b46bd654269b9ae83ba5e1705a8215f670fa887746353d589ea3c0545d525c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ory_langchain-1.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ce79d540511bb8a900a8a35271e5ac69fcbc8c9d4e4eb52f2720f2782429696
MD5 538fd57c8eb99bd5d19099e7fe6cdc56
BLAKE2b-256 f20f9dc7ab889901a18eaefb848938d733a78d47934862a6cd06161301509695

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.1

2 files

1.0.0

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