Skip to main content

langchain-frame

LangChain tools for Frame, a static analysis security scanner. Frame follows attacker-controlled data through code, across functions and files, and checks each finding with a solver. It runs locally and needs no API key.

tool runs returns
FrameScanTool (frame_scan) frame scan <path> -f json the findings, a summary, and the path of the full report
FrameVerifyTool (frame_verify) frame verify <report> -f json each earlier finding's status after a change, and all_fixed

Together they let an agent scan code, change it, and check that the change removed the finding rather than moving or hiding it.

Installation

pip install -U langchain-frame

This installs frame-security[scan], which provides the frame command. Frame scans Python, JavaScript/TypeScript, Java, C# and C/C++.

Scan

import json

from langchain_frame import FrameScanTool

scan = FrameScanTool(root_dir="/path/to/repo")
result = json.loads(scan.invoke({"path": "src/", "min_severity": "high"}))

result["summary"]   # {"files_scanned": 4, "total_vulnerabilities": 1, "critical": 1, ...}
result["findings"]  # [{"type": "sql_injection", "severity": "critical", "cwe_id": "CWE-89",
                    #   "path": "shop/services/orders.py", "line": 7,
                    #   "description": "Tainted data from 'request.args' flows to sql sink",
                    #   "evidence": "solver-verified",
                    #   "data_flow": ["shop/app.py:11 -> shop/services/orders.py::for_customer(name)"],
                    #   "fingerprint": "..."}]
result["report"]    # path of the full JSON report, for frame_verify

evidence is Frame's own measure of how strongly a finding is shown, weakest first: matched, llm-detected, llm-verified, data-flow, solver-verified, exploit-confirmed.

Check a fix

from langchain_frame import FrameVerifyTool

verify = FrameVerifyTool()
status = json.loads(verify.invoke({"report": result["report"]}))

status["results"]    # [{"fingerprint": "...", "status": "fixed", ...}]
status["all_fixed"]  # True only when every checked finding is fixed or its file removed

A status is one of fixed, file_removed, present, suppressed, uncertain or unverifiable. Pass fingerprints=[...] to check only some findings.

In an agent

from langchain.agents import create_agent
from langchain_frame import FrameScanTool, FrameVerifyTool

root = "/path/to/repo"
agent = create_agent(
    "anthropic:claude-opus-5-5",
    tools=[FrameScanTool(root_dir=root), FrameVerifyTool(root_dir=root), *file_editing_tools],
    system_prompt=(
        "Scan the repository with frame_scan, fix the critical findings, "
        "then confirm each fix with frame_verify."
    ),
)

Options

Both tools take:

argument default
root_dir none resolve relative paths against this directory and refuse paths outside it
frame_command [sys.executable, "-m", "frame"] how to start Frame, for example ["frame"]
timeout 900 seconds before the Frame process is stopped

FrameScanTool also takes:

argument default
extra_args [] more frame scan flags, for example ["--sca"] for vulnerable dependencies or ["--iac"] for infrastructure files
report_dir a temporary directory where full JSON reports are written
max_findings 50 most findings returned to the model; the report keeps them all

The model only chooses the path and the minimum severity. Flags such as --ai, which sends code to a model you configure for Frame, can only be turned on by the developer through extra_args. Frame's settings in .frame.toml or [tool.frame] in pyproject.toml apply as usual; see the Frame usage docs.

Errors, such as a missing path or a scan Frame could not run, are returned to the model as the tool result instead of raising.

Development

uv sync --all-groups
make test               # unit tests, Frame process mocked
make integration_tests  # runs Frame on tests/fixtures, offline
make lint

tests/fixtures is a two-file Flask app with a deliberate SQL injection, used by the integration tests.

License

Apache-2.0, the same as Frame.

Metadata

Release files for langchain-frame 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langchain-frame 0.1.0
File Size Uploaded Provenance Actions
langchain_frame-0.1.0.tar.gz 12.9 kB Without provenance Details for langchain_frame-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-frame 0.1.0
File Interpreter ABI Platform Actions
langchain_frame-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_frame-0.1.0-py3-none-any.whl

Total release size: 24.2 kB

Release files / langchain_frame-0.1.0.tar.gz

Download URL langchain_frame-0.1.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
bc008e1fd0df5de9cbe618767847c180f2278798715f6430736779de05f6b036
BLAKE2b-256 checksum
How to use checksums
c72f5577474c6f4f91c5ad8183f7cc8c3f8cf95082697bd8c81696ea215d2046
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / langchain_frame-0.1.0-py3-none-any.whl

Download URL langchain_frame-0.1.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8fd048825a8b996712edf8668ee050a9583e2efbd96edac024696f1fe1bed83
BLAKE2b-256 checksum
How to use checksums
51387c5367cca91fce0a8c050e07f934530bcddf708dd2fb01154fedfe1f5fbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for langchain-frame 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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