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_llmpayload 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, andmodel. 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
Metadata
Release files for fortifyos-langchain 1.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fortifyos_langchain-1.1.3.tar.gz | 9.1 kB | Without provenance | Details for fortifyos_langchain-1.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fortifyos_langchain-1.1.3-py3-none-any.whl | Python 3 | none | any | Details for fortifyos_langchain-1.1.3-py3-none-any.whl |
Total release size: 18.8 kB
Release files / fortifyos_langchain-1.1.3.tar.gz
| Download URL | fortifyos_langchain-1.1.3.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c45a828857bb1c52a9f8e02d9852178cc1c9b6a43d6016f2e0f7ff7922ca8b2e
|
|
BLAKE2b-256 checksum How to use checksums |
df41a286201a57e2d68343968d7a19f1e8b20917c4fb472ec9cd59a985a03ba8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / fortifyos_langchain-1.1.3-py3-none-any.whl
| Download URL | fortifyos_langchain-1.1.3-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e67d411f1428f4aa830e0251d8378aba8fbbbcb10a5f0119f909a7ed6b9589a
|
|
BLAKE2b-256 checksum How to use checksums |
4d7597264abc1d76fe2996ec8ed52c943b78e3c44b97971605cd1e59ec88a0c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for fortifyos-langchain 1.1.3
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.