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. Tracing — every invocation is recorded as a structured span (OTLP + NDJSON).
  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 span 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. Set ORY_PERMISSION_MODE=enforce or run ory-argus permissions enforce.

Tracing only

If you only want observability (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-0.14.0.tar.gz (7.9 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-0.14.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ory_langchain-0.14.0.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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-0.14.0.tar.gz
Algorithm Hash digest
SHA256 976e644ed7b955e0c7b8d15ae631796829b87b2933cc0da562537459b62fd910
MD5 c511efe8617f5162d10a9d2487cdd702
BLAKE2b-256 3041c56afcaf225156e9fe05661ae0dec7dffe4cc688c2125e8385bc0376c9b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ory_langchain-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.31 {"installer":{"name":"uv","version":"0.11.31","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-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe431704d45b1589b49cd7802faf828e930c5941eed738f839bccd2b85604ea2
MD5 9b633ab5d82f4307dffe5ac410612278
BLAKE2b-256 d949b1809e7f83270f321437bb1526a6e4eb22c1c6066a824435febc0e4f0d9a

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

This release

0.14.0 This release

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