securevector-sdk-langgraph 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- securevector_sdk_langgraph/__init__.py +56 -0
- securevector_sdk_langgraph/_version.py +7 -0
- securevector_sdk_langgraph/auto.py +37 -0
- securevector_sdk_langgraph/client.py +223 -0
- securevector_sdk_langgraph/config.py +54 -0
- securevector_sdk_langgraph/core.py +180 -0
- securevector_sdk_langgraph/errors.py +26 -0
- securevector_sdk_langgraph/handler.py +92 -0
- securevector_sdk_langgraph/middleware.py +109 -0
- securevector_sdk_langgraph/tool_id.py +39 -0
- securevector_sdk_langgraph-1.0.0.dist-info/METADATA +150 -0
- securevector_sdk_langgraph-1.0.0.dist-info/RECORD +16 -0
- securevector_sdk_langgraph-1.0.0.dist-info/WHEEL +5 -0
- securevector_sdk_langgraph-1.0.0.dist-info/licenses/LICENSE +202 -0
- securevector_sdk_langgraph-1.0.0.dist-info/licenses/NOTICE +15 -0
- securevector_sdk_langgraph-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"""SecureVector SDK for LangGraph.
|
|
2
|
+
|
|
3
|
+
Enforcement (recommended) — the ``wrap_tool_call`` middleware, accepted by the
|
|
4
|
+
langgraph-backed ``create_agent`` (note: ``langgraph.prebuilt.create_react_agent``
|
|
5
|
+
does NOT take a ``middleware`` argument — use ``create_agent``)::
|
|
6
|
+
|
|
7
|
+
from securevector_sdk_langgraph import secure_middleware
|
|
8
|
+
from langchain.agents import create_agent
|
|
9
|
+
|
|
10
|
+
agent = create_agent(
|
|
11
|
+
model, tools,
|
|
12
|
+
middleware=[secure_middleware(mode="enforce")],
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
Observe-only logging (any graph) — pass the callback handler in config::
|
|
16
|
+
|
|
17
|
+
from securevector_sdk_langgraph import SecureVectorCallbackHandler
|
|
18
|
+
graph.invoke(state, config={"callbacks": [SecureVectorCallbackHandler()]})
|
|
19
|
+
|
|
20
|
+
For a raw ``StateGraph`` with custom tool nodes (no middleware surface), gate
|
|
21
|
+
execution with LangGraph's ``interrupt()`` inside the tool — see the README.
|
|
22
|
+
|
|
23
|
+
Either way, every tool call runs the local SecureVector app's three controls —
|
|
24
|
+
tool-call permissions, secret/data-leak detection, threat detection — and each
|
|
25
|
+
decision is written to the app's tamper-evident audit chain with
|
|
26
|
+
``runtime_kind="langgraph"``. Requires the SecureVector app running locally
|
|
27
|
+
(installed automatically as the ``securevector-ai-monitor`` dependency).
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
import logging
|
|
31
|
+
from typing import Optional
|
|
32
|
+
|
|
33
|
+
from ._version import __version__
|
|
34
|
+
from .config import Config
|
|
35
|
+
from .errors import AppUnreachable, SecureVectorError, ToolBlocked
|
|
36
|
+
from .handler import SecureVectorCallbackHandler
|
|
37
|
+
from .middleware import secure_middleware
|
|
38
|
+
|
|
39
|
+
log = logging.getLogger("securevector_sdk_langgraph")
|
|
40
|
+
|
|
41
|
+
__all__ = [
|
|
42
|
+
"__version__",
|
|
43
|
+
"secure_middleware",
|
|
44
|
+
"install",
|
|
45
|
+
"SecureVectorCallbackHandler",
|
|
46
|
+
"Config",
|
|
47
|
+
"SecureVectorError",
|
|
48
|
+
"ToolBlocked",
|
|
49
|
+
"AppUnreachable",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def install(mode: str = "observe", base_url: Optional[str] = None, **kwargs):
|
|
54
|
+
"""Convenience alias for :func:`secure_middleware` — returns the middleware
|
|
55
|
+
to pass to ``create_agent(..., middleware=[install(mode="enforce")])``."""
|
|
56
|
+
return secure_middleware(mode=mode, base_url=base_url, **kwargs)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""``import securevector_sdk_langgraph.auto`` — observe-mode global logging.
|
|
2
|
+
|
|
3
|
+
There is no global registration for middleware (it is passed to
|
|
4
|
+
``create_agent``), so this module registers an **observe-only** callback handler
|
|
5
|
+
as a LangChain global handler where the version supports it. For enforcement,
|
|
6
|
+
add ``secure_middleware(mode="enforce")`` to your agent's ``middleware`` list.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import logging
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from .handler import SecureVectorCallbackHandler
|
|
13
|
+
|
|
14
|
+
log = logging.getLogger("securevector_sdk_langgraph")
|
|
15
|
+
|
|
16
|
+
_handler = SecureVectorCallbackHandler()
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
# Best-effort: register as a global handler so existing chains are logged.
|
|
20
|
+
from langchain_core.callbacks.manager import register_configure_hook
|
|
21
|
+
from contextvars import ContextVar
|
|
22
|
+
|
|
23
|
+
_var: ContextVar = ContextVar("securevector_sdk_langgraph_handler", default=None)
|
|
24
|
+
_var.set(_handler)
|
|
25
|
+
register_configure_hook(_var, True)
|
|
26
|
+
except Exception as exc: # pragma: no cover - depends on langchain version
|
|
27
|
+
log.warning(
|
|
28
|
+
"Global observe handler unavailable (%s); pass SecureVectorCallbackHandler "
|
|
29
|
+
"via config={'callbacks': [...]}, or use secure_middleware to enforce.",
|
|
30
|
+
exc,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
if os.environ.get("SECUREVECTOR_SDK_MODE", "observe").lower() == "enforce":
|
|
34
|
+
log.warning(
|
|
35
|
+
"SECUREVECTOR_SDK_MODE=enforce has no effect via auto-import (callbacks "
|
|
36
|
+
"cannot block). Add secure_middleware(mode='enforce') to create_agent."
|
|
37
|
+
)
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"""Thin client to the local SecureVector app.
|
|
2
|
+
|
|
3
|
+
Two transports, on purpose:
|
|
4
|
+
|
|
5
|
+
* **Tool-permission resolution + audit** go over the local REST API
|
|
6
|
+
(``/api/tool-permissions/*``) via the stdlib (``urllib``) — no extra HTTP
|
|
7
|
+
dependency. The permission *decision* is computed client-side by merging the
|
|
8
|
+
three policy tiers exactly as the app's own OpenClaw hook does:
|
|
9
|
+
synced (cloud-pushed) > local override > essential registry > default-allow.
|
|
10
|
+
|
|
11
|
+
* **Secret + threat detection** reuses the already-shipped ``SecureVectorClient``
|
|
12
|
+
from ``securevector-ai-monitor`` — the detection engine lives there; the
|
|
13
|
+
adapter must not reimplement it.
|
|
14
|
+
|
|
15
|
+
Everything is best-effort and lazy: importing this module never requires the
|
|
16
|
+
app or langchain to be installed, so unit tests run standalone.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
import logging
|
|
21
|
+
import urllib.error
|
|
22
|
+
import urllib.parse
|
|
23
|
+
import urllib.request
|
|
24
|
+
from dataclasses import dataclass
|
|
25
|
+
from typing import Any, Dict, List, Optional
|
|
26
|
+
|
|
27
|
+
from .config import Config
|
|
28
|
+
from .errors import AppUnreachable
|
|
29
|
+
from .tool_id import RUNTIME_KIND
|
|
30
|
+
|
|
31
|
+
log = logging.getLogger("securevector_sdk_langgraph")
|
|
32
|
+
|
|
33
|
+
_VALID_AUDIT_ACTIONS = ("block", "allow", "log_only")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass
|
|
37
|
+
class Verdict:
|
|
38
|
+
"""Resolved permission decision for one tool id."""
|
|
39
|
+
|
|
40
|
+
action: str # allow | block | log_only
|
|
41
|
+
risk: str
|
|
42
|
+
reason: str
|
|
43
|
+
is_essential: bool
|
|
44
|
+
tool_id: str
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass
|
|
48
|
+
class AnalysisVerdict:
|
|
49
|
+
"""Outcome of a secret/threat scan over a piece of text."""
|
|
50
|
+
|
|
51
|
+
is_threat: bool
|
|
52
|
+
risk_score: int
|
|
53
|
+
reason: str
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class LocalAppClient:
|
|
57
|
+
def __init__(self, cfg: Config):
|
|
58
|
+
self.cfg = cfg
|
|
59
|
+
|
|
60
|
+
# ------------------------------------------------------------------ #
|
|
61
|
+
# REST transport (stdlib) #
|
|
62
|
+
# ------------------------------------------------------------------ #
|
|
63
|
+
def _request(self, method: str, path: str, body: Optional[dict]) -> Any:
|
|
64
|
+
url = f"{self.cfg.base_url.rstrip('/')}{path}"
|
|
65
|
+
data = json.dumps(body).encode("utf-8") if body is not None else None
|
|
66
|
+
req = urllib.request.Request(
|
|
67
|
+
url,
|
|
68
|
+
data=data,
|
|
69
|
+
method=method,
|
|
70
|
+
headers={"Content-Type": "application/json"},
|
|
71
|
+
)
|
|
72
|
+
timeout = max(self.cfg.timeout_ms / 1000.0, 0.1)
|
|
73
|
+
with urllib.request.urlopen(req, timeout=timeout) as resp: # noqa: S310 (localhost)
|
|
74
|
+
raw = resp.read()
|
|
75
|
+
return json.loads(raw) if raw else {}
|
|
76
|
+
|
|
77
|
+
def _get(self, path: str) -> Any:
|
|
78
|
+
return self._request("GET", path, None)
|
|
79
|
+
|
|
80
|
+
def _post(self, path: str, body: dict) -> Any:
|
|
81
|
+
return self._request("POST", path, body)
|
|
82
|
+
|
|
83
|
+
def reachable(self) -> bool:
|
|
84
|
+
try:
|
|
85
|
+
self._get("/api/tool-permissions/essential")
|
|
86
|
+
return True
|
|
87
|
+
except Exception:
|
|
88
|
+
return False
|
|
89
|
+
|
|
90
|
+
# ------------------------------------------------------------------ #
|
|
91
|
+
# (a) Permissions — synced > override > essential > default-allow #
|
|
92
|
+
# ------------------------------------------------------------------ #
|
|
93
|
+
def resolve_permission(self, tool_id: str) -> Verdict:
|
|
94
|
+
try:
|
|
95
|
+
essential = self._get("/api/tool-permissions/essential") or {}
|
|
96
|
+
overrides = self._get("/api/tool-permissions/overrides") or {}
|
|
97
|
+
synced = self._get(
|
|
98
|
+
"/api/tool-permissions/synced-overrides?"
|
|
99
|
+
+ urllib.parse.urlencode({"runtime": RUNTIME_KIND})
|
|
100
|
+
) or {}
|
|
101
|
+
except (urllib.error.URLError, OSError, json.JSONDecodeError) as exc:
|
|
102
|
+
raise AppUnreachable(str(exc)) from exc
|
|
103
|
+
return self._resolve(tool_id, essential, overrides, synced)
|
|
104
|
+
|
|
105
|
+
@staticmethod
|
|
106
|
+
def _index(arr: Optional[List[dict]], key: str) -> Dict[str, dict]:
|
|
107
|
+
"""Index rows by their id, with a case-insensitive fallback (exact
|
|
108
|
+
casing wins, mirroring the app's lookup)."""
|
|
109
|
+
out: Dict[str, dict] = {}
|
|
110
|
+
for item in arr or []:
|
|
111
|
+
k = item.get(key)
|
|
112
|
+
if k is not None:
|
|
113
|
+
out.setdefault(str(k).lower(), item)
|
|
114
|
+
for item in arr or []:
|
|
115
|
+
k = item.get(key)
|
|
116
|
+
if k is not None:
|
|
117
|
+
out[str(k)] = item
|
|
118
|
+
return out
|
|
119
|
+
|
|
120
|
+
def _resolve(self, tool_id, essential, overrides, synced) -> Verdict:
|
|
121
|
+
name = tool_id
|
|
122
|
+
low = tool_id.lower()
|
|
123
|
+
emap = self._index(essential.get("tools"), "tool_id")
|
|
124
|
+
omap = self._index(overrides.get("overrides"), "tool_id")
|
|
125
|
+
smap = self._index(synced.get("synced"), "tool_id")
|
|
126
|
+
|
|
127
|
+
# 1. Cloud-pushed synced policy wins.
|
|
128
|
+
s = smap.get(name) or smap.get(low)
|
|
129
|
+
if s:
|
|
130
|
+
effect = str(s.get("effect", "")).lower()
|
|
131
|
+
action = "allow" if effect == "allow" else "block"
|
|
132
|
+
policy = s.get("policy_name") or s.get("policy_id") or "synced"
|
|
133
|
+
ver = f" v{s['policy_version']}" if s.get("policy_version") is not None else ""
|
|
134
|
+
return Verdict(
|
|
135
|
+
action, "synced", f"Synced policy '{policy}'{ver}: {effect}",
|
|
136
|
+
(name in emap or low in emap), name,
|
|
137
|
+
)
|
|
138
|
+
# 2. Local user override.
|
|
139
|
+
o = omap.get(name) or omap.get(low)
|
|
140
|
+
if o:
|
|
141
|
+
return Verdict(
|
|
142
|
+
o.get("action", "allow"), "overridden",
|
|
143
|
+
f"User override: {o.get('action')}",
|
|
144
|
+
(name in emap or low in emap), name,
|
|
145
|
+
)
|
|
146
|
+
# 3. Essential registry default.
|
|
147
|
+
e = emap.get(name) or emap.get(low)
|
|
148
|
+
if e:
|
|
149
|
+
return Verdict(
|
|
150
|
+
e.get("effective_action") or e.get("default_action") or "allow",
|
|
151
|
+
e.get("risk", "unknown"), e.get("reason", "Essential tool policy"),
|
|
152
|
+
True, name,
|
|
153
|
+
)
|
|
154
|
+
# 4. Not in registry — allowed by default.
|
|
155
|
+
return Verdict("allow", "unknown", "Not in registry — allowed by default", False, name)
|
|
156
|
+
|
|
157
|
+
# ------------------------------------------------------------------ #
|
|
158
|
+
# (b)+(c) Secret + threat detection — the running app's /api/analyze #
|
|
159
|
+
# ------------------------------------------------------------------ #
|
|
160
|
+
# We deliberately use the app's REST `/analyze` (same engine, same HTTP
|
|
161
|
+
# transport as permissions/audit) rather than constructing an in-process
|
|
162
|
+
# SecureVectorClient: the SDK already requires the app running, and the
|
|
163
|
+
# in-process local analyzer needs its own config/license and can raise on
|
|
164
|
+
# init. Tool input is user→tool ("outgoing"); tool output is fetched
|
|
165
|
+
# context→model, which is exactly the app's IDPI "incoming" scan mode.
|
|
166
|
+
_DIRECTION_MODE = {"tool_input": "outgoing", "tool_output": "incoming"}
|
|
167
|
+
|
|
168
|
+
def analyze(self, text: str, direction: str) -> AnalysisVerdict:
|
|
169
|
+
if not text:
|
|
170
|
+
return AnalysisVerdict(False, 0, "empty")
|
|
171
|
+
mode = self._DIRECTION_MODE.get(direction, "outgoing")
|
|
172
|
+
try:
|
|
173
|
+
# The analyze route is mounted at /analyze (no /api prefix).
|
|
174
|
+
res = self._post("/analyze", {"text": str(text)[:102400], "mode": mode})
|
|
175
|
+
except (urllib.error.URLError, OSError, json.JSONDecodeError) as exc:
|
|
176
|
+
raise AppUnreachable(f"analyze failed: {exc}") from exc
|
|
177
|
+
if not isinstance(res, dict):
|
|
178
|
+
return AnalysisVerdict(False, 0, "no-result")
|
|
179
|
+
risk = int(res.get("risk_score") or 0)
|
|
180
|
+
is_threat = bool(res.get("is_threat", False))
|
|
181
|
+
# Secrets/data-leaks also surface via redaction: the app sets
|
|
182
|
+
# redacted_text (and action_taken=redact/block) when it catches a secret.
|
|
183
|
+
# Control (b) keys on that, control (c) on is_threat. A finding is either.
|
|
184
|
+
has_secret = bool(res.get("redacted_text")) or (res.get("action_taken") in ("redact", "block"))
|
|
185
|
+
finding = is_threat or has_secret
|
|
186
|
+
return AnalysisVerdict(
|
|
187
|
+
finding, risk,
|
|
188
|
+
f"{direction} threat={is_threat} secret={has_secret} risk={risk}",
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
# ------------------------------------------------------------------ #
|
|
192
|
+
# Audit — append to the tamper-evident chain #
|
|
193
|
+
# ------------------------------------------------------------------ #
|
|
194
|
+
def record_audit(
|
|
195
|
+
self,
|
|
196
|
+
*,
|
|
197
|
+
tool_id: str,
|
|
198
|
+
function_name: Optional[str],
|
|
199
|
+
action: str,
|
|
200
|
+
risk: Optional[str],
|
|
201
|
+
reason: Optional[str],
|
|
202
|
+
is_essential: bool,
|
|
203
|
+
args_preview: Optional[str],
|
|
204
|
+
session_id: Optional[str] = None,
|
|
205
|
+
request_id: Optional[str] = None,
|
|
206
|
+
) -> None:
|
|
207
|
+
act = action if action in _VALID_AUDIT_ACTIONS else "log_only"
|
|
208
|
+
body = {
|
|
209
|
+
"tool_id": tool_id,
|
|
210
|
+
"function_name": function_name or tool_id,
|
|
211
|
+
"action": act,
|
|
212
|
+
"risk": risk,
|
|
213
|
+
"reason": reason,
|
|
214
|
+
"is_essential": bool(is_essential),
|
|
215
|
+
"args_preview": args_preview,
|
|
216
|
+
"runtime_kind": RUNTIME_KIND,
|
|
217
|
+
"session_id": session_id,
|
|
218
|
+
"request_id": (request_id or None) and str(request_id)[:64],
|
|
219
|
+
}
|
|
220
|
+
try:
|
|
221
|
+
self._post("/api/tool-permissions/call-audit", body)
|
|
222
|
+
except Exception as exc: # never let audit failure break the agent
|
|
223
|
+
log.debug("audit post failed: %s", exc)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Adapter configuration — explicit kwargs override environment overrides
|
|
2
|
+
defaults.
|
|
3
|
+
|
|
4
|
+
Environment variables (all optional):
|
|
5
|
+
SECUREVECTOR_SDK_APP_URL local app base URL (default http://127.0.0.1:8741)
|
|
6
|
+
SECUREVECTOR_SDK_MODE observe | enforce (default observe)
|
|
7
|
+
SECUREVECTOR_SDK_TIMEOUT_MS per-call verdict timeout (default 3000)
|
|
8
|
+
SECUREVECTOR_SDK_RISK_THRESHOLD enforce-block risk cutoff (default 70)
|
|
9
|
+
SECUREVECTOR_SDK_ANALYZE_MODE SecureVectorClient mode (default local)
|
|
10
|
+
SECUREVECTOR_SDK_DISABLED set truthy to no-op entirely
|
|
11
|
+
|
|
12
|
+
Note: we deliberately use SECUREVECTOR_SDK_APP_URL, not the existing
|
|
13
|
+
SECUREVECTOR_URL — the latter points at the *cloud* API in the rest of the
|
|
14
|
+
ecosystem, whereas the SDK talks to the *local* app.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import os
|
|
18
|
+
from dataclasses import dataclass
|
|
19
|
+
|
|
20
|
+
DEFAULT_BASE_URL = "http://127.0.0.1:8741"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _truthy(val: str) -> bool:
|
|
24
|
+
return str(val).strip().lower() in ("1", "true", "yes", "on")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class Config:
|
|
29
|
+
base_url: str = DEFAULT_BASE_URL
|
|
30
|
+
mode: str = "observe" # observe (fail-open) | enforce (fail-closed)
|
|
31
|
+
timeout_ms: int = 3000
|
|
32
|
+
threat_risk_threshold: int = 70 # risk_score >= this blocks in enforce mode
|
|
33
|
+
analyze_mode: str = "local" # SecureVectorClient mode used for /analyze
|
|
34
|
+
enabled: bool = True
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_env(cls, **overrides) -> "Config":
|
|
38
|
+
cfg = cls(
|
|
39
|
+
base_url=os.environ.get("SECUREVECTOR_SDK_APP_URL", DEFAULT_BASE_URL),
|
|
40
|
+
mode=os.environ.get("SECUREVECTOR_SDK_MODE", "observe").strip().lower(),
|
|
41
|
+
timeout_ms=int(os.environ.get("SECUREVECTOR_SDK_TIMEOUT_MS", "3000")),
|
|
42
|
+
threat_risk_threshold=int(
|
|
43
|
+
os.environ.get("SECUREVECTOR_SDK_RISK_THRESHOLD", "70")
|
|
44
|
+
),
|
|
45
|
+
analyze_mode=os.environ.get("SECUREVECTOR_SDK_ANALYZE_MODE", "local"),
|
|
46
|
+
enabled=not _truthy(os.environ.get("SECUREVECTOR_SDK_DISABLED", "")),
|
|
47
|
+
)
|
|
48
|
+
# Explicit kwargs win over env, but only when actually provided.
|
|
49
|
+
for key, value in overrides.items():
|
|
50
|
+
if value is not None and hasattr(cfg, key):
|
|
51
|
+
setattr(cfg, key, value)
|
|
52
|
+
if cfg.mode not in ("observe", "enforce"):
|
|
53
|
+
cfg.mode = "observe"
|
|
54
|
+
return cfg
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""Control routing — the three checks on every tool call.
|
|
2
|
+
|
|
3
|
+
This is the framework-agnostic engine. Detection already exists in the app; the
|
|
4
|
+
job here is **routing + the observe/enforce state machine**. The public surface
|
|
5
|
+
is deliberately non-raising so each adapter can choose how to *act* on a block:
|
|
6
|
+
|
|
7
|
+
* the LangChain/LangGraph ``wrap_tool_call`` middleware returns a ``ToolMessage``
|
|
8
|
+
to short-circuit (the documented block primitive);
|
|
9
|
+
* the CrewAI tool wrapper raises ``ToolBlocked`` (CrewAI has no middleware).
|
|
10
|
+
|
|
11
|
+
Per intercepted call, in order:
|
|
12
|
+
|
|
13
|
+
(a) PERMISSIONS — resolve allow/block for the tool id
|
|
14
|
+
(b) SECRET scan — \\
|
|
15
|
+
(c) THREAT scan — // over the serialized tool input (and, on end, output)
|
|
16
|
+
|
|
17
|
+
``observe`` (default) is fail-open: everything is logged, nothing is blocked,
|
|
18
|
+
and an unreachable app degrades to allow. ``enforce`` is fail-closed: a policy
|
|
19
|
+
block, a high-risk input finding, or an unreachable app all mark the decision
|
|
20
|
+
``blocked``.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
import logging
|
|
24
|
+
import re
|
|
25
|
+
import sys
|
|
26
|
+
from dataclasses import dataclass
|
|
27
|
+
from typing import Optional
|
|
28
|
+
|
|
29
|
+
from .client import LocalAppClient
|
|
30
|
+
from .config import Config
|
|
31
|
+
from .errors import AppUnreachable, ToolBlocked
|
|
32
|
+
|
|
33
|
+
log = logging.getLogger("securevector_sdk_langgraph")
|
|
34
|
+
|
|
35
|
+
# Belt-and-braces preview redaction (the app redacts too; this keeps obvious
|
|
36
|
+
# secrets out of the args_preview we send).
|
|
37
|
+
_REDACTIONS = [
|
|
38
|
+
(re.compile(r"AKIA[A-Z0-9]{16}"), "AKIA[REDACTED]"),
|
|
39
|
+
(re.compile(r"ghp_[A-Za-z0-9]{36}"), "ghp_[REDACTED]"),
|
|
40
|
+
(re.compile(r"sk-[A-Za-z0-9]{20,}"), "sk-[REDACTED]"),
|
|
41
|
+
(re.compile(r"(?i)(password\"?\s*[:=]\s*\")[^\"]+(\")"), r"\1[REDACTED]\2"),
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def redact(text: object, limit: int = 500) -> str:
|
|
46
|
+
if not text:
|
|
47
|
+
return ""
|
|
48
|
+
s = str(text)
|
|
49
|
+
for pattern, repl in _REDACTIONS:
|
|
50
|
+
s = pattern.sub(repl, s)
|
|
51
|
+
return s[:limit]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass
|
|
55
|
+
class Decision:
|
|
56
|
+
"""Result of evaluating a tool call's input. ``blocked`` already accounts
|
|
57
|
+
for mode — it is only True when the call should actually be stopped (i.e.
|
|
58
|
+
enforce mode + a deny). ``action`` is the audited action."""
|
|
59
|
+
|
|
60
|
+
blocked: bool
|
|
61
|
+
action: str # allow | block | log_only
|
|
62
|
+
reason: str
|
|
63
|
+
risk: str
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class Interceptor:
|
|
67
|
+
def __init__(self, cfg: Config, client: Optional[LocalAppClient] = None):
|
|
68
|
+
self.cfg = cfg
|
|
69
|
+
self.client = client or LocalAppClient(cfg)
|
|
70
|
+
self._disclosed = False
|
|
71
|
+
|
|
72
|
+
@property
|
|
73
|
+
def enforce(self) -> bool:
|
|
74
|
+
return self.cfg.mode == "enforce"
|
|
75
|
+
|
|
76
|
+
def _disclose_once(self) -> None:
|
|
77
|
+
if self.enforce and not self._disclosed:
|
|
78
|
+
self._disclosed = True
|
|
79
|
+
sys.stderr.write(
|
|
80
|
+
"[SecureVector] SDK is in ENFORCE mode — tool calls will be "
|
|
81
|
+
"BLOCKED if a policy denies them or the local app is unreachable.\n"
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
# ------------------------------------------------------------------ #
|
|
85
|
+
# Primary, non-raising API #
|
|
86
|
+
# ------------------------------------------------------------------ #
|
|
87
|
+
def evaluate_input(
|
|
88
|
+
self,
|
|
89
|
+
tool_id: str,
|
|
90
|
+
args_text: str,
|
|
91
|
+
*,
|
|
92
|
+
session_id: Optional[str] = None,
|
|
93
|
+
request_id: Optional[str] = None,
|
|
94
|
+
) -> Decision:
|
|
95
|
+
"""Run the three controls on a tool's input and return a Decision.
|
|
96
|
+
Records the audit row as a side effect. Never raises."""
|
|
97
|
+
if not self.cfg.enabled:
|
|
98
|
+
return Decision(False, "allow", "sdk disabled", "")
|
|
99
|
+
self._disclose_once()
|
|
100
|
+
preview = redact(args_text)
|
|
101
|
+
|
|
102
|
+
# (a) PERMISSIONS
|
|
103
|
+
try:
|
|
104
|
+
verdict = self.client.resolve_permission(tool_id)
|
|
105
|
+
except AppUnreachable:
|
|
106
|
+
if self.enforce:
|
|
107
|
+
return Decision(True, "block", "local app unreachable (fail-closed)", "unreachable")
|
|
108
|
+
log.warning("app unreachable; observe mode allows %s", tool_id)
|
|
109
|
+
return Decision(False, "allow", "app unreachable (observe, fail-open)", "unreachable")
|
|
110
|
+
|
|
111
|
+
if verdict.action == "block":
|
|
112
|
+
self.client.record_audit(
|
|
113
|
+
tool_id=tool_id, function_name=tool_id, action="block",
|
|
114
|
+
risk=verdict.risk, reason=verdict.reason,
|
|
115
|
+
is_essential=verdict.is_essential, args_preview=preview,
|
|
116
|
+
session_id=session_id, request_id=request_id,
|
|
117
|
+
)
|
|
118
|
+
return Decision(self.enforce, "block", verdict.reason, verdict.risk)
|
|
119
|
+
|
|
120
|
+
# (b)+(c) SECRET + THREAT on the tool input
|
|
121
|
+
a_in = None
|
|
122
|
+
try:
|
|
123
|
+
a_in = self.client.analyze(args_text, "tool_input")
|
|
124
|
+
except AppUnreachable:
|
|
125
|
+
a_in = None # analysis best-effort; permissions already passed
|
|
126
|
+
|
|
127
|
+
if a_in and a_in.is_threat:
|
|
128
|
+
should_block = self.enforce and a_in.risk_score >= self.cfg.threat_risk_threshold
|
|
129
|
+
act = "block" if should_block else "log_only"
|
|
130
|
+
self.client.record_audit(
|
|
131
|
+
tool_id=tool_id, function_name=tool_id, action=act,
|
|
132
|
+
risk=str(a_in.risk_score),
|
|
133
|
+
reason=f"Input secret/threat detected (risk={a_in.risk_score})",
|
|
134
|
+
is_essential=verdict.is_essential, args_preview=preview,
|
|
135
|
+
session_id=session_id, request_id=request_id,
|
|
136
|
+
)
|
|
137
|
+
return Decision(should_block, act, f"input secret/threat risk={a_in.risk_score}", str(a_in.risk_score))
|
|
138
|
+
|
|
139
|
+
# Allowed — record the decision.
|
|
140
|
+
self.client.record_audit(
|
|
141
|
+
tool_id=tool_id, function_name=tool_id, action="allow",
|
|
142
|
+
risk=verdict.risk, reason=verdict.reason,
|
|
143
|
+
is_essential=verdict.is_essential, args_preview=preview,
|
|
144
|
+
session_id=session_id, request_id=request_id,
|
|
145
|
+
)
|
|
146
|
+
return Decision(False, "allow", verdict.reason, verdict.risk)
|
|
147
|
+
|
|
148
|
+
def scan_output(
|
|
149
|
+
self,
|
|
150
|
+
tool_id: str,
|
|
151
|
+
output_text: str,
|
|
152
|
+
*,
|
|
153
|
+
session_id: Optional[str] = None,
|
|
154
|
+
request_id: Optional[str] = None,
|
|
155
|
+
) -> None:
|
|
156
|
+
"""Scan the tool RESULT for secrets / exfiltration (observe-only — the
|
|
157
|
+
tool already ran). Records a row if anything is found. Never raises."""
|
|
158
|
+
if not self.cfg.enabled:
|
|
159
|
+
return
|
|
160
|
+
try:
|
|
161
|
+
a_out = self.client.analyze(output_text, "tool_output")
|
|
162
|
+
except AppUnreachable:
|
|
163
|
+
return
|
|
164
|
+
if a_out and a_out.is_threat:
|
|
165
|
+
self.client.record_audit(
|
|
166
|
+
tool_id=tool_id, function_name=tool_id, action="log_only",
|
|
167
|
+
risk=str(a_out.risk_score),
|
|
168
|
+
reason=f"Output secret/threat detected (risk={a_out.risk_score})",
|
|
169
|
+
is_essential=False, args_preview=redact(output_text),
|
|
170
|
+
session_id=session_id, request_id=request_id,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
# ------------------------------------------------------------------ #
|
|
174
|
+
# Raising convenience (CrewAI wrapper, where blocking == raising) #
|
|
175
|
+
# ------------------------------------------------------------------ #
|
|
176
|
+
def guard_input(self, tool_id: str, args_text: str, **kwargs) -> Decision:
|
|
177
|
+
decision = self.evaluate_input(tool_id, args_text, **kwargs)
|
|
178
|
+
if decision.blocked:
|
|
179
|
+
raise ToolBlocked(tool_id, decision.reason)
|
|
180
|
+
return decision
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Exceptions raised by the SecureVector LangChain adapter.
|
|
2
|
+
|
|
3
|
+
``ToolBlocked`` is the one that matters operationally: in ``enforce`` mode the
|
|
4
|
+
callback handler raises it from ``on_tool_start`` *before* the tool executes,
|
|
5
|
+
which aborts the tool step. In ``observe`` mode it is never raised — the call
|
|
6
|
+
is logged and allowed through.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SecureVectorError(Exception):
|
|
11
|
+
"""Base class for all adapter errors."""
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ToolBlocked(SecureVectorError):
|
|
15
|
+
"""Raised in enforce mode to abort a tool call (policy block, input threat,
|
|
16
|
+
or fail-closed when the local app is unreachable)."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, tool_id: str, reason: str):
|
|
19
|
+
self.tool_id = tool_id
|
|
20
|
+
self.reason = reason
|
|
21
|
+
super().__init__(f"SecureVector blocked tool '{tool_id}': {reason}")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class AppUnreachable(SecureVectorError):
|
|
25
|
+
"""The local SecureVector app could not be reached. Mode decides the
|
|
26
|
+
consequence: observe → allow (fail-open); enforce → deny (fail-closed)."""
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""Observe-mode LangChain callback handler.
|
|
2
|
+
|
|
3
|
+
Callbacks are an **observability** surface — they cannot cleanly block a tool
|
|
4
|
+
call (raising from them is version-dependent and tends to crash the run rather
|
|
5
|
+
than return a clean result). So this handler is for **logging/audit** in
|
|
6
|
+
contexts where the ``wrap_tool_call`` middleware isn't available (legacy
|
|
7
|
+
AgentExecutor, raw LCEL chains). For real enforcement, use
|
|
8
|
+
:func:`securevector_sdk_langgraph.secure_middleware` with ``create_agent``.
|
|
9
|
+
|
|
10
|
+
Attach it via ``config={"callbacks": [SecureVectorCallbackHandler()]}``.
|
|
11
|
+
``run_id`` correlates start→end so the output scan is attributed to the same
|
|
12
|
+
tool.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
import logging
|
|
17
|
+
import uuid
|
|
18
|
+
from typing import Any, Dict, Optional
|
|
19
|
+
|
|
20
|
+
from .config import Config
|
|
21
|
+
from .core import Interceptor
|
|
22
|
+
|
|
23
|
+
log = logging.getLogger("securevector_sdk_langgraph")
|
|
24
|
+
|
|
25
|
+
try: # langchain-core ships with langchain; guard so tests import standalone
|
|
26
|
+
from langchain_core.callbacks import BaseCallbackHandler
|
|
27
|
+
except Exception: # pragma: no cover
|
|
28
|
+
try:
|
|
29
|
+
from langchain.callbacks.base import BaseCallbackHandler # type: ignore
|
|
30
|
+
except Exception:
|
|
31
|
+
BaseCallbackHandler = object # type: ignore
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _to_text(value: Any) -> str:
|
|
35
|
+
if value is None:
|
|
36
|
+
return ""
|
|
37
|
+
if isinstance(value, str):
|
|
38
|
+
return value
|
|
39
|
+
try:
|
|
40
|
+
return json.dumps(value, default=str)
|
|
41
|
+
except Exception:
|
|
42
|
+
return str(value)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class SecureVectorCallbackHandler(BaseCallbackHandler):
|
|
46
|
+
"""Observe-only audit handler. Logs the three controls' findings for every
|
|
47
|
+
tool call; does not block (use ``secure_middleware`` to enforce)."""
|
|
48
|
+
|
|
49
|
+
def __init__(self, mode: Optional[str] = None, base_url: Optional[str] = None, **kwargs):
|
|
50
|
+
# Force observe: callbacks cannot reliably block, so we never pretend to.
|
|
51
|
+
kwargs.pop("mode", None)
|
|
52
|
+
self.cfg = Config.from_env(mode="observe", base_url=base_url, **kwargs)
|
|
53
|
+
self.interceptor = Interceptor(self.cfg)
|
|
54
|
+
self._session = uuid.uuid4().hex[:16]
|
|
55
|
+
self._runs: Dict[Any, str] = {}
|
|
56
|
+
if mode == "enforce":
|
|
57
|
+
log.warning(
|
|
58
|
+
"SecureVectorCallbackHandler runs in observe mode only; for "
|
|
59
|
+
"enforcement use secure_middleware(mode='enforce') with create_agent."
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def on_tool_start(
|
|
63
|
+
self,
|
|
64
|
+
serialized: Optional[dict],
|
|
65
|
+
input_str: str,
|
|
66
|
+
*,
|
|
67
|
+
run_id: Any = None,
|
|
68
|
+
**kwargs: Any,
|
|
69
|
+
) -> None:
|
|
70
|
+
from .tool_id import normalize_tool_id
|
|
71
|
+
|
|
72
|
+
tool_id = normalize_tool_id(serialized, kwargs.get("name"))
|
|
73
|
+
if run_id is not None:
|
|
74
|
+
self._runs[run_id] = tool_id
|
|
75
|
+
self.interceptor.evaluate_input(
|
|
76
|
+
tool_id,
|
|
77
|
+
_to_text(input_str),
|
|
78
|
+
session_id=self._session,
|
|
79
|
+
request_id=str(run_id) if run_id is not None else None,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
def on_tool_end(self, output: Any, *, run_id: Any = None, **kwargs: Any) -> None:
|
|
83
|
+
tool_id = self._runs.pop(run_id, None) or "unknown"
|
|
84
|
+
self.interceptor.scan_output(
|
|
85
|
+
tool_id,
|
|
86
|
+
_to_text(output),
|
|
87
|
+
session_id=self._session,
|
|
88
|
+
request_id=str(run_id) if run_id is not None else None,
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
def on_tool_error(self, error: BaseException, *, run_id: Any = None, **kwargs: Any) -> None:
|
|
92
|
+
self._runs.pop(run_id, None)
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"""LangChain v1 ``wrap_tool_call`` middleware — the primary interception path.
|
|
2
|
+
|
|
3
|
+
This is the documented way to intercept a tool call before it runs and block
|
|
4
|
+
it: the middleware receives a ``ToolCallRequest`` (with structured
|
|
5
|
+
``tool_call["name"]`` / ``["args"]``), and either calls ``handler(request)`` to
|
|
6
|
+
execute the tool or returns a ``ToolMessage`` *without* calling the handler to
|
|
7
|
+
short-circuit it. Returning a ``ToolMessage`` is the sanctioned block — it
|
|
8
|
+
feeds a clean result back to the model instead of raising.
|
|
9
|
+
|
|
10
|
+
from securevector_sdk_langgraph import secure_middleware
|
|
11
|
+
from langchain.agents import create_agent
|
|
12
|
+
|
|
13
|
+
agent = create_agent(model, tools, middleware=[secure_middleware(mode="enforce")])
|
|
14
|
+
|
|
15
|
+
Works for both LangChain ``create_agent`` and LangGraph
|
|
16
|
+
``create_react_agent``/``create_agent`` (they share the middleware surface).
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
import logging
|
|
21
|
+
import uuid
|
|
22
|
+
from typing import Any, Callable, Optional
|
|
23
|
+
|
|
24
|
+
from .config import Config
|
|
25
|
+
from .core import Interceptor
|
|
26
|
+
|
|
27
|
+
log = logging.getLogger("securevector_sdk_langgraph")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _to_text(value: Any) -> str:
|
|
31
|
+
if value is None:
|
|
32
|
+
return ""
|
|
33
|
+
if isinstance(value, str):
|
|
34
|
+
return value
|
|
35
|
+
try:
|
|
36
|
+
return json.dumps(value, default=str)
|
|
37
|
+
except Exception:
|
|
38
|
+
return str(value)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _result_text(result: Any) -> str:
|
|
42
|
+
"""Pull text out of whatever the tool handler returned (usually a
|
|
43
|
+
ToolMessage, possibly a Command or raw value)."""
|
|
44
|
+
content = getattr(result, "content", None)
|
|
45
|
+
if content is not None:
|
|
46
|
+
return _to_text(content)
|
|
47
|
+
return _to_text(result)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _make_tool_call_handler(
|
|
51
|
+
interceptor: Interceptor,
|
|
52
|
+
session: str,
|
|
53
|
+
tool_message_factory: Callable[..., Any],
|
|
54
|
+
):
|
|
55
|
+
"""Build the ``(request, handler)`` callable used by ``wrap_tool_call``.
|
|
56
|
+
|
|
57
|
+
Factored out (and parameterised on the ToolMessage factory) so it is unit
|
|
58
|
+
testable without a full LangChain v1 install.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
def _securevector(request, handler):
|
|
62
|
+
tool_call = getattr(request, "tool_call", None) or {}
|
|
63
|
+
name = tool_call.get("name") or "unknown"
|
|
64
|
+
args = tool_call.get("args")
|
|
65
|
+
call_id = tool_call.get("id")
|
|
66
|
+
req = uuid.uuid4().hex[:16]
|
|
67
|
+
|
|
68
|
+
decision = interceptor.evaluate_input(
|
|
69
|
+
name, _to_text(args), session_id=session, request_id=req
|
|
70
|
+
)
|
|
71
|
+
if decision.blocked:
|
|
72
|
+
# Documented short-circuit: return a ToolMessage WITHOUT running the
|
|
73
|
+
# tool. The model sees a clean blocked result, not an exception.
|
|
74
|
+
return tool_message_factory(
|
|
75
|
+
content=f"[SecureVector] Tool '{name}' blocked: {decision.reason}",
|
|
76
|
+
tool_call_id=call_id,
|
|
77
|
+
status="error",
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
result = handler(request)
|
|
81
|
+
interceptor.scan_output(
|
|
82
|
+
name, _result_text(result), session_id=session, request_id=req
|
|
83
|
+
)
|
|
84
|
+
return result
|
|
85
|
+
|
|
86
|
+
return _securevector
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def secure_middleware(mode: str = "observe", base_url: Optional[str] = None, **kwargs):
|
|
90
|
+
"""Build a SecureVector ``wrap_tool_call`` middleware.
|
|
91
|
+
|
|
92
|
+
``mode``: ``"observe"`` (fail-open, default) or ``"enforce"`` (fail-closed —
|
|
93
|
+
denied tools are short-circuited with a ToolMessage before they run).
|
|
94
|
+
Raises ``ImportError`` if LangChain v1's middleware API is unavailable.
|
|
95
|
+
"""
|
|
96
|
+
try:
|
|
97
|
+
from langchain.agents.middleware import wrap_tool_call
|
|
98
|
+
from langchain.messages import ToolMessage
|
|
99
|
+
except Exception as exc: # pragma: no cover - depends on langchain version
|
|
100
|
+
raise ImportError(
|
|
101
|
+
"secure_middleware requires LangChain v1 (langchain>=1.0) for "
|
|
102
|
+
"langchain.agents.middleware.wrap_tool_call. For older versions, "
|
|
103
|
+
"use SecureVectorCallbackHandler for observe-only logging."
|
|
104
|
+
) from exc
|
|
105
|
+
|
|
106
|
+
cfg = Config.from_env(mode=mode, base_url=base_url, **kwargs)
|
|
107
|
+
interceptor = Interceptor(cfg)
|
|
108
|
+
session = uuid.uuid4().hex[:16]
|
|
109
|
+
return wrap_tool_call(_make_tool_call_handler(interceptor, session, ToolMessage))
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"""Canonical tool-id normalization — the ONLY framework-specific mapping.
|
|
2
|
+
|
|
3
|
+
The whole SecureVector fleet keys permissions and audit on a single canonical
|
|
4
|
+
``tool_id``. LangChain surfaces a tool's name as ``Tool.name``, delivered in
|
|
5
|
+
the callback's ``serialized["name"]`` (or, for newer cores, a flat ``name``
|
|
6
|
+
kwarg). Normalizing it here is the one piece of LangChain-specific code; every
|
|
7
|
+
downstream step (permission resolution, analysis, audit) is shared engine
|
|
8
|
+
behaviour, so a policy authored once — "allow web_search, block shell" —
|
|
9
|
+
applies identically across LangChain / LangGraph / CrewAI.
|
|
10
|
+
|
|
11
|
+
Casing is preserved: the local app matches tool ids case-insensitively, so a
|
|
12
|
+
rule authored ``tool_id="Bash"`` still governs a LangChain tool named ``bash``.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from typing import Any, Optional
|
|
16
|
+
|
|
17
|
+
# The audit/Bill-of-Tools/OCSF pipeline groups by this attribution tag.
|
|
18
|
+
RUNTIME_KIND = "langgraph"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def normalize_tool_id(serialized: Any, name: Optional[str] = None) -> str:
|
|
22
|
+
"""Resolve a canonical tool id from a LangChain ``on_tool_start`` payload.
|
|
23
|
+
|
|
24
|
+
Accepts the legacy ``serialized`` dict (``{"name": ...}`` or a dotted
|
|
25
|
+
``{"id": [...]}`` path) and/or a flat ``name`` kwarg. Falls back to
|
|
26
|
+
``"unknown"`` so a missing name never crashes the agent.
|
|
27
|
+
"""
|
|
28
|
+
raw: Optional[str] = None
|
|
29
|
+
if isinstance(serialized, dict):
|
|
30
|
+
raw = serialized.get("name")
|
|
31
|
+
if not raw:
|
|
32
|
+
ident = serialized.get("id")
|
|
33
|
+
if isinstance(ident, (list, tuple)) and ident:
|
|
34
|
+
raw = str(ident[-1])
|
|
35
|
+
if not raw:
|
|
36
|
+
raw = name
|
|
37
|
+
if not raw:
|
|
38
|
+
return "unknown"
|
|
39
|
+
return str(raw).strip() or "unknown"
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: securevector-sdk-langgraph
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: SecureVector SDK for LangGraph — brings the local threat monitor's three controls (tool-call permissions, secret/data-leak detection, threat detection) to every LangGraph tool call, with tamper-evident audit logging.
|
|
5
|
+
Author: SecureVector
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://securevector.io
|
|
8
|
+
Project-URL: Source, https://github.com/Secure-Vector/securevector-sdk-langgraph
|
|
9
|
+
Keywords: langgraph,langchain,llm,security,ai-agent,audit,compliance,tool-permissions
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Topic :: Security
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
License-File: NOTICE
|
|
19
|
+
Requires-Dist: securevector-ai-monitor>=4.7
|
|
20
|
+
Requires-Dist: langgraph>=1.0
|
|
21
|
+
Requires-Dist: langchain>=1.0
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# SecureVector SDK for LangGraph
|
|
27
|
+
|
|
28
|
+
[](https://pypi.org/project/securevector-sdk-langgraph/)
|
|
29
|
+
[](https://pypistats.org/packages/securevector-sdk-langgraph)
|
|
30
|
+
[](https://pypi.org/project/securevector-sdk-langgraph/)
|
|
31
|
+
[](LICENSE)
|
|
32
|
+
|
|
33
|
+
> Bring the SecureVector local threat monitor's three controls — **tool-call
|
|
34
|
+
> permissions**, **secret / data-leak detection**, and **threat detection** —
|
|
35
|
+
> to every LangGraph tool call, with tamper-evident audit logging. One import.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pip install securevector-sdk-langgraph
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
> 📦 **One install — batteries included.** `pip install securevector-sdk-langgraph`
|
|
42
|
+
> **also installs the local SecureVector app** (`securevector-ai-monitor`): the
|
|
43
|
+
> adapter **and** the detection engine + tamper-evident audit chain arrive in a
|
|
44
|
+
> single `pip install`. The SDK is a thin interception layer — **the app must be
|
|
45
|
+
> running locally** (`securevector-app --web`) for it to do anything.
|
|
46
|
+
|
|
47
|
+
## Quick start
|
|
48
|
+
|
|
49
|
+
**Enforcement (recommended)** — the documented `wrap_tool_call` middleware,
|
|
50
|
+
accepted by the langgraph-backed `create_agent` (note:
|
|
51
|
+
`langgraph.prebuilt.create_react_agent` does **not** take a `middleware`
|
|
52
|
+
argument — use `create_agent`):
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from securevector_sdk_langgraph import secure_middleware
|
|
56
|
+
from langchain.agents import create_agent
|
|
57
|
+
|
|
58
|
+
agent = create_agent(
|
|
59
|
+
model, tools,
|
|
60
|
+
middleware=[secure_middleware(mode="enforce")],
|
|
61
|
+
)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
A denied tool is short-circuited with a `ToolMessage` before it runs — no
|
|
65
|
+
exceptions, no crashed graph.
|
|
66
|
+
|
|
67
|
+
**Observe-only logging** for any graph (passes through `langchain-core`'s
|
|
68
|
+
callback manager):
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
from securevector_sdk_langgraph import SecureVectorCallbackHandler
|
|
72
|
+
|
|
73
|
+
graph.invoke(state, config={"callbacks": [SecureVectorCallbackHandler()]})
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Raw `StateGraph` with custom tool nodes** (no middleware surface): gate the
|
|
77
|
+
tool with LangGraph's documented `interrupt()` for human/programmatic approval:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from langgraph.types import interrupt
|
|
81
|
+
|
|
82
|
+
@tool
|
|
83
|
+
def run_query(sql: str):
|
|
84
|
+
interrupt({"action": "run_query", "args": {"sql": sql}}) # pause for approval
|
|
85
|
+
...
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
> Why these paths? LangGraph **callbacks are observability-only** — they cannot
|
|
89
|
+
> cleanly block a tool. The **`wrap_tool_call` middleware** (for `create_agent`)
|
|
90
|
+
> and **`interrupt()`** (for raw graphs) are the documented gates.
|
|
91
|
+
|
|
92
|
+
## What happens on every tool call
|
|
93
|
+
|
|
94
|
+
Before a tool node runs, the SDK:
|
|
95
|
+
|
|
96
|
+
1. **(a) Permissions** — resolves an allow/block verdict for the tool, using the
|
|
97
|
+
app's own precedence: cloud-pushed **synced** policy → local **override** →
|
|
98
|
+
**essential** registry → default-allow.
|
|
99
|
+
2. **(b)+(c) Secret & threat scan** — sends the serialized tool input through the
|
|
100
|
+
app's `/analyze` pipeline.
|
|
101
|
+
|
|
102
|
+
After the tool returns, the result is scanned the same way to catch secrets /
|
|
103
|
+
exfiltration in tool output. Every decision is written to the app's audit chain
|
|
104
|
+
tagged `runtime_kind="langgraph"`.
|
|
105
|
+
|
|
106
|
+
## observe vs enforce
|
|
107
|
+
|
|
108
|
+
| | local app reachable | local app unreachable |
|
|
109
|
+
|---|---|---|
|
|
110
|
+
| **observe** (default) | log + advisory verdict; tool always runs | tool runs (fail-open) |
|
|
111
|
+
| **enforce** (opt-in) | tool runs only if the verdict ≠ block | **tool denied** (fail-closed) |
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
agent = create_agent(model, tools, middleware=[secure_middleware(mode="enforce")])
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Enforce mode prints a one-time disclosure to stderr. (Enforcement requires the
|
|
118
|
+
middleware or `interrupt()` path; the observe callback handler always logs only.)
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
All optional, via env or `install(...)` kwargs:
|
|
123
|
+
|
|
124
|
+
| Env var | Default | Meaning |
|
|
125
|
+
|---|---|---|
|
|
126
|
+
| `SECUREVECTOR_SDK_APP_URL` | `http://127.0.0.1:8741` | local app base URL |
|
|
127
|
+
| `SECUREVECTOR_SDK_MODE` | `observe` | `observe` or `enforce` |
|
|
128
|
+
| `SECUREVECTOR_SDK_TIMEOUT_MS` | `3000` | per-call verdict timeout |
|
|
129
|
+
| `SECUREVECTOR_SDK_RISK_THRESHOLD` | `70` | risk score that blocks in enforce mode |
|
|
130
|
+
| `SECUREVECTOR_SDK_DISABLED` | _(unset)_ | set truthy to no-op |
|
|
131
|
+
|
|
132
|
+
## Compliance
|
|
133
|
+
|
|
134
|
+
The tool-call-level, attributed, tamper-evident audit trail this produces is
|
|
135
|
+
exactly the **action-layer logging** auditors ask for under **EU AI Act
|
|
136
|
+
Art. 12 / 15**. This SDK produces the local evidence; the cloud governance
|
|
137
|
+
surface turns it into an auditor-ready pack.
|
|
138
|
+
|
|
139
|
+
## Trademarks
|
|
140
|
+
|
|
141
|
+
**SecureVector** is the product name of this SDK. **LangGraph** and
|
|
142
|
+
**LangChain** are trademarks of LangChain, Inc. This is an independent,
|
|
143
|
+
community SDK that *integrates with* LangGraph via its public callback API. It
|
|
144
|
+
is **not affiliated with, sponsored by, or endorsed by LangChain, Inc.** The
|
|
145
|
+
name uses "langgraph" only descriptively, to identify the framework this
|
|
146
|
+
package works with (nominative fair use).
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
securevector_sdk_langgraph/__init__.py,sha256=UD4py1z-evvSMzfeLNDZNVBYEC0dv8pR4V9EytceygQ,2071
|
|
2
|
+
securevector_sdk_langgraph/_version.py,sha256=ZBY5VP_hooD3w9sSMGeOp1i0zb6iwFKq83T6DjQI2AM,240
|
|
3
|
+
securevector_sdk_langgraph/auto.py,sha256=w6QEINe-27muvjGmJnKwMaC3eQeeVxdQ3jMRgD-s_pM,1446
|
|
4
|
+
securevector_sdk_langgraph/client.py,sha256=kaKBTS9WB0_jtoSl-_A8_SgUMXm5NEeq9v2L3_v7Qrg,9162
|
|
5
|
+
securevector_sdk_langgraph/config.py,sha256=mWaJZ_xIEInTH1n3ylqyDZ9MHNwQUCcD6lGDNayTgE8,2299
|
|
6
|
+
securevector_sdk_langgraph/core.py,sha256=0AzflWqGT-oMwER48HLCi-v_KPcUSOYJQFBHB0FN0KI,7206
|
|
7
|
+
securevector_sdk_langgraph/errors.py,sha256=LbpINzHdiP62-N6PNm2HZNGjON1xDKMZxp9XAGG6HVU,982
|
|
8
|
+
securevector_sdk_langgraph/handler.py,sha256=sUkkotbvEoqvkhSWx8paU5yZU3YJ2JB8eE2eQaeirTE,3343
|
|
9
|
+
securevector_sdk_langgraph/middleware.py,sha256=KBKghBP5xtBbPFpE7I-YyutSLQGJCF80C2GihaRgqIo,4003
|
|
10
|
+
securevector_sdk_langgraph/tool_id.py,sha256=pEMu0dQL0qr_jMVXeou7d2Eh5BhH9-B0vdLv4SKKJVQ,1643
|
|
11
|
+
securevector_sdk_langgraph-1.0.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
12
|
+
securevector_sdk_langgraph-1.0.0.dist-info/licenses/NOTICE,sha256=BRqOuh_6RkQGy-jba3gfwmNCJtwb4Zt5y0T9g8aob80,688
|
|
13
|
+
securevector_sdk_langgraph-1.0.0.dist-info/METADATA,sha256=xGHvW9QoWlA_eXsynwWNi3A5GU4_INrfTqn8YeaMqZg,6050
|
|
14
|
+
securevector_sdk_langgraph-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
15
|
+
securevector_sdk_langgraph-1.0.0.dist-info/top_level.txt,sha256=pI2M7W3QCE3mHGrODwy2-cqayBf6AE6LIgEBHvOxrj4,27
|
|
16
|
+
securevector_sdk_langgraph-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
SecureVector SDK for LangGraph
|
|
2
|
+
Copyright (c) SecureVector
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
This software integrates with the LangGraph framework via its public callback
|
|
7
|
+
API. "LangGraph" and "LangChain" are trademarks of LangChain, Inc. This
|
|
8
|
+
package is an independent, community integration and is not affiliated with,
|
|
9
|
+
sponsored by, or endorsed by LangChain, Inc. The framework name is used only
|
|
10
|
+
descriptively to identify compatibility (nominative fair use).
|
|
11
|
+
|
|
12
|
+
This package depends on:
|
|
13
|
+
- securevector-ai-monitor (the local SecureVector app + SDK)
|
|
14
|
+
- langgraph (MIT, (c) LangChain, Inc.)
|
|
15
|
+
- langchain-core (Apache-2.0, (c) LangChain, Inc.)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
securevector_sdk_langgraph
|