Skip to main content

FortifyOS runtime protection for LangChain and LangGraph agents — zero code changes required.

Project description

fortifyos-langchain

Runtime security for LangChain and LangGraph agents — with zero code changes.

fortifyos-langchain auto-attaches the FortifyOS policy engine to every LangChain agent running in your Python environment. It intercepts LLM calls and tool invocations, runs your security policies as plain shell scripts, and allows or blocks the action based on the result.

No imports. No callback wiring. No modifications to your agent code.

Installation

pip install fortifyos-langchain

How It Works

A .pth file shipped with the package is auto-loaded by Python on every interpreter startup, attaching a FortifyHandler globally to LangChain via register_configure_hook. The handler reads ~/.fortifyos/langchain.json to map lifecycle events to shell scripts under ~/.fortifyos/hooks/langchain/.

Event Fires when
pre_llm Before an LLM / chat-model call
post_llm After an LLM responds — includes generations, tool_calls, finish_reason, token_usage
pre_tool Before a tool runs
post_tool After a tool returns

Script exit code 0 allows the action; non-zero blocks it.

What's New In 0.1.1

  • post_llm payload now includes the actual model output: generations[].text, generations[].content, generations[].tool_calls (the tools the LLM wants to invoke), generations[].finish_reason, token_usage, and model. Useful for inspecting tool calls before they run, detecting content-filter triggers, and tracking token cost.

Disabling Protection

Set FORTIFYOS_DISABLE=1 to skip the auto-attach for a single run.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fortifyos_langchain-1.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fortifyos_langchain-1.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file fortifyos_langchain-1.1.1.tar.gz.

File metadata

  • Download URL: fortifyos_langchain-1.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for fortifyos_langchain-1.1.1.tar.gz
Algorithm Hash digest
SHA256 89fd8a920e73626397837d0c0ae9485cc09f66ddb6e3fe0ca5e6bccdcc7b8faf
MD5 a0e7c3940e75e81f9565201bfd2c9624
BLAKE2b-256 902077f2708b69da3f74c6129d4b00ebe7f4252e9b74f5a026d3af0e8d552b6b

See more details on using hashes here.

File details

Details for the file fortifyos_langchain-1.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fortifyos_langchain-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4140bbc587ca6b09263d83137fc32bcf7911f65a6edef50d3f41b24257347230
MD5 a53f3c9ee1a04ec0081c6b18017dc17a
BLAKE2b-256 51471fb78faf49e77a69ec56c9a8c6db16c32161682e5b56a24023051a4e950a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page