Scan a compiled LangGraphDocumentation Index
Fetch the complete documentation index at: https://docs.agentguardian.io/llms.txt
Use this file to discover all available pages before exploring further.
StateGraph by handing AgentGuardian a module-level
reference to the graph object — no wrapper script, no HTTP server.
When to use this
- Your agent is built with LangGraph and you can
importthe compiled graph from a Python module. - You want AgentGuardian to drive the graph directly (Mode D, framework adapter) instead of going through a code entry-point (Mode B) or an HTTP endpoint (Mode C).
- You want hook-based instrumentation —
on_tool_call,on_memory_write,on_agent_message— wired through the framework adapter base class.
LangGraphAdapter duck-types your graph: it accepts anything that
exposes ainvoke(state) or invoke(state) and returns a state dict with a
messages list. LangGraph itself is not a runtime dependency of
AgentGuardian — the adapter only imports from your target’s process.
1. Install the LangGraph extras
The OSS install stays lean by default. Pull in the demo extras so the bundled LangGraph fixtures are importable:langgraph>=0.2, langchain-core>=0.3, and
langchain-google-genai>=2.0 (used by the fixture targets in
examples/langgraph/). If you’re scanning your own LangGraph project,
install AgentGuardian into that project’s environment instead and skip the
examples extra — only your graph needs to be importable on PYTHONPATH.
2. Write (or pick) a LangGraph target
The simplest legal target is a single-node graph that wraps one LLM call. Save the following asmy_chatbot.py somewhere on your PYTHONPATH:
my_chatbot.py
graph above). The attribute name is up to you — you
pass it after the colon in --framework-ref.
If you don’t want to write your own yet, the repo ships three working
fixtures under examples/langgraph/:
| Module | Tier | Shape |
|---|---|---|
examples.langgraph.simple_chatbot | T4 | Stateless single-node graph |
examples.langgraph.support_with_tool | T3 | One tool + canned KB with sensitive entries |
examples.langgraph.personal_assistant_pii | T1 | Three tools + per-session notes + PII |
graph (for --framework langgraph) and run
(for the code adapter).
3. Run the scan
Point--framework-ref at MODULE:ATTR. The CLI imports the module
normally — any import-time side effects (logging setup, env reads) fire
exactly as they would in your own process.
src/agent_guardian/cli.py:
--framework langgraph— one ofadk,autogen,crewai,langgraph,openai_agents,strands.--framework-ref my_chatbot:graph—MODULE:ATTR(colon form preferred;MODULE.ATTRdotted form is also accepted). The attribute must be the compiled graph, i.e. the return value ofStateGraph(...).compile().--model stub— the universal safe default; runs the scan offline with no LLM keys. Swap forgemini:gemini-2.5-flash,openai:gpt-4o,anthropic:claude-haiku-4-5,ollama:llama3.1, or a Bedrock model spec when you want a real assessment.--mode fast— caps each agent at 3 probes / 4 turns (~45s, ~$0.008 on Gemini). Use--mode smartfor the v1.0 early-stop default, or--mode full(default) for the authoritative run.--output md --output-path scan.md— render the report as Markdown toscan.md. Other formats:json,sarif,junit,pdf.
4. Expected output
The Markdown report starts with the scan header. The exact numbers depend on your--model, your graph, and your --mode; this is the shape:
--model stub scan will always come back clean — the stub model
deliberately gives the swarm nothing to attack with. Once you re-run with
a real model (--model gemini:gemini-2.5-flash is the cheapest
useful choice) you’ll get a populated Top findings table and a real
AIVSS score.
5. How to interpret the result
- Tier — auto-detected from your graph’s shape. The single-node
chatbot above lands in T4 (no tools, no memory). The
support_with_toolfixture is T3 (tools, no memory). Thepersonal_assistant_piifixture is T1 (tools + memory + PII). Force a different tier with--tier T1|T2|T3|T4. - AIVSS — 0..100 composite score across the ten ASI categories.
n/a (not evaluated)appears when you scan with--model stubbecause the stub never triggers the evaluator path. - Per-ASI breakdown — one row per OWASP-LLM-aligned ASI category.
A row at
100.0with 0 findings means the swarm couldn’t make that category bite. A lower score with findings is where to start reading. - Top findings — the highest-severity transcript per agent, with the prompt, the target response, and the evaluator’s verdict. Use these as PoV reproducers.
6. Caveats specific to LangGraph
- The framework adapter is Mode D. It marks the fingerprint with
has_tools=True, has_memory=True, touches_pii=Falseregardless of your graph’s actual shape — the adapter does not introspect the compiled graph for nodes or tool bindings. If your target carries PII or you want a more aggressive tier, set marker attributes on your module (tools = [...],memory = {...}) the wayexamples.langgraph.personal_assistant_piidoes, or force the tier with--tier T1. - Session tokens are not threaded into the graph state. LangGraph
carries state inside the graph itself, so AgentGuardian’s per-session
isolation probes can’t drive a LangGraph target through the framework
adapter. If you need cross-session leakage coverage, expose a
run()entry-point that consumes asession=kwarg and scan with the code adapter instead (seeexamples.langgraph.personal_assistant_pii.run). - Hook firing (
on_tool_call,on_memory_write,on_agent_message) is best-effort — the base class accepts registrations, but full runtime instrumentation of LangGraph internals is an M-future milestone.
Next step
- For a tool-bearing target with KB leakage fixtures, read
Tool Abuse and re-run with
--framework-ref examples.langgraph.support_with_tool:graph. - For a PII + memory target with per-session bucketing, read
Prompt Injection and switch to the code
adapter so session tokens flow:
uv run agent-guardian scan examples.langgraph.personal_assistant_pii:run. - For CI gating, wire the same
--framework-refinvocation into GitHub Actions with--fail-under 70and--output sarif.