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.13.9.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.13.9-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ory_langchain-0.13.9.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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.13.9.tar.gz
Algorithm Hash digest
SHA256 dd4677e3a7df328aab0c1f1912d3c7d1df8867d24355573770638b0fe9503a74
MD5 6dc767a186e31b77235c28281f5ae520
BLAKE2b-256 0e2492736ded38194132a2a9444859761003d8e3fdbb0ab9de65338cd24796e9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ory_langchain-0.13.9-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","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.13.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7daee5a6c6476282179378ddf95778b75a72bd1b0bfbd869703f69a487af01fc
MD5 fe97f4342952122cba8ca2270fe7cec8
BLAKE2b-256 1c53cfde2e731f4f8b3120299182fb31d0dbc6b95ecf8926e801193bad1112ec

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

0.14.0

2 files

This release

0.13.9 This release

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