Runtime Observability & Integrity Monitor for LangGraph Agents
Argos Panoptes β the hundred-eyed all-seeing watcher of Greek myth
LangGraph agents make decisions based on a shared state object. Every node reads from it. Every node writes to it. If that state is poisoned β through prompt injection, memory tampering, serialization exploits, or malicious tool outputs β every downstream decision the agent makes serves the attacker, not you.
Argos is an open-source runtime observability & integrity monitor purpose-built for LangGraph agent state. It wraps your agent, watches every state transition in real time across four detection layers, and halts execution before a compromised agent takes an irreversible action.
from argos import Argos
watcher = Argos(graph, rules="config/rules.yaml")
result = watcher.run(input_data)Three lines. Full runtime protection.
These are not theoretical attacks. All three are documented in 2024β2025 research:
- CVE-2025-64439 β Checkpoint Deserialization RCE
LangGraph's defaultJsonPlusSerializerwas vulnerable to remote code execution via malicious JSON payloads injected into checkpoint storage. The exploit triggers on read, not write β making it invisible to write-time scanners. - Microsoft Email Agent Memory Poisoning (Greshake et al., 2024)
A LangGraph email agent was compromised by injecting a poisoned memory string. The agent autonomously began forwarding all sensitive communications to an attacker-controlled address. 40% success rate. Zero human interaction required. - MemoryGraft (arXiv, Dec 2024)
Persistent attack technique that implants malicious "successful experiences" into an agent's long-term memory, exploiting the semantic imitation heuristic. Survives across sessions. Not detectable by structural diffing alone.
Argos defends against all three.
Argos patches every node in a compiled LangGraph graph with pre and post execution hooks. Before each node runs, the pre-hook captures a state snapshot and checks the halt signal. After each node runs, the post-hook captures the new state, computes a structural diff, and routes the transition through all four detection layers in parallel.
flowchart LR
A[LangGraph Agent] -->|state| B[Argos Watcher]
B --> C[Pre-Hook: Snapshot + HALT check]
C --> D[Node Execution]
D --> E[Post-Hook: Diff + Detection]
E --> F1[Layer 1: Snapshot Diff]
E --> F2[Layer 2: Semantic Anomaly]
E --> F3[Layer 3: Rule Engine]
E --> F4[Layer 4: Behavioral Monitor]
F1 --> G[Alert Bus]
F2 --> G
F3 --> G
F4 --> G
G -->|HALT| H[Block Next Node]
G -->|Audit| I[(SQLite HMAC-signed)]
- Layer 1 β Snapshot & Diff Engine
Computes structural diffs between consecutive state snapshots usingdeepdiff. Every snapshot is SHA-256 hashed and HMAC-SHA256 signed for tamper-evident audit integrity. - Layer 2 β Semantic Anomaly Detector
Uses sentence embeddings (all-MiniLM-L6-v2) to compute cosine similarity between consecutive state values. A baseline profiler learns per-field similarity distributions from clean runs and flags deviations beyond a statistical z-threshold. Catches MemoryGraft-style attacks where state is semantically poisoned without structural changes. - Layer 3 β Rule Engine
YARA-inspired integrity rules defined in YAML. Rules are validated with Pydantic v2 and matched usinggoogle-re2(linear-time regex, ReDoS-immune). Ships with default rules for system prompt immutability, external URL detection, and token-limit enforcement. - Layer 4 β Behavioral Monitor
Tracks node execution patterns usingnetworkx. Detects infinite loops, unauthorized state transitions in strict topology mode, timing anomalies, and tool call frequency spikes.
| Level | Behavior |
|---|---|
WARNING |
Log and continue |
CRITICAL |
Log, notify all handlers, continue with monitoring flag |
HALT |
Block all subsequent node execution. Require human approval to resume. |
# Requires Python 3.11+
git clone https://github.com/Vasco1290/Argos.git
cd Argos
python -m venv .venv
.venv\Scripts\activate # Windows
source .venv/bin/activate # macOS / Linux
pip install -e ".[dev]"Run the included email agent memory poisoning demo:
python demo.pyThe demo simulates the Greshake et al. 2024 attack scenario:
- A LangGraph email agent processes incoming mail across three nodes:
retrieve β summarise β send - Four baseline runs profile the agent's normal semantic state
- Run 5 injects a poisoned email attempting to redirect forwarding to
attacker@evil.com - Argos's Rules layer catches the forwarding address mutation (
FWD-001) - Argos's Semantic layer independently catches the same attack with a z-score of ~1654
- The
sendnode never executes. No email is delivered to the attacker.
End-to-end in under 30 seconds.
from langgraph.graph import StateGraph
from argos import Argos
graph = StateGraph(MyState)
# ... define nodes and edges ...
compiled = graph.compile()
watcher = Argos(compiled, rules="config/rules.yaml")
result = watcher.run({"messages": [...]})from argos import Argos, WatcherConfig
config = WatcherConfig(
db_path="my_audit.db",
webhook_url="https://hooks.example.com/alert",
enable_semantic=True,
enable_rules=True,
enable_behavioural=True,
enable_canary=True,
)
watcher = Argos(compiled, config=config)from argos.core.alerts import ArgosHaltException
try:
result = watcher.run(input_data)
except ArgosHaltException as e:
print(f"Attack blocked: {e.alert.explanation}")
# ... investigate, then approve resumption ...
watcher.resume()
result = watcher.run(input_data)config/rules.yaml:
rules:
- id: FWD-001
field: forward_to
operator: EQUALS
value: "user@company.com"
level: 60 # HALT
description: "Email forwarding address must always be the verified user address."
- id: PROMPT-001
field: system_prompt
operator: REGEX
value: "^You are a helpful assistant"
level: 50 # CRITICAL
description: "System prompt must not be modified at runtime."pytest argos/tests/ -v109 tests, 0 failures, ~11 seconds.
Coverage includes:
- Cryptographic integrity verification (HMAC tampering detection)
- Simulated prompt injection scenarios
- Memory poisoning attack simulation
- Canary field exfiltration detection
- Behavioral loop detection
- Multi-session isolation
argos/
βββ core/
β βββ alerts.py # AlertEmitter, three-level severity, HALT mechanism
β βββ snapshot.py # State capture + HMAC-signed audit trail
β βββ watcher.py # Main wrapper, node patching, layer orchestration
β βββ rules.py # YARA-inspired YAML rule engine
β βββ semantic.py # Embedding-based anomaly detection
β βββ behaviour.py # Execution pattern monitoring
βββ canary/
β βββ canary.py # Sentinel field injection + exfiltration detection
βββ dashboard/
β βββ terminal.py # Real-time Rich terminal UI
βββ api/
β βββ server.py # Optional FastAPI monitoring REST API
βββ tests/ # 109 tests across all modules
- Core detection layers (alerts, snapshot, watcher, rules, semantic, behavioural, canary)
- Cryptographic audit trail with HMAC-SHA256 tamper detection
- Working email agent memory poisoning demo
- 109 passing tests on Python 3.11
- Community attack signature library
- Multi-framework support (CrewAI, AutoGen, LlamaIndex)
- LLM-powered alert triage and incident summary
- Cross-agent provenance tracking in multi-agent systems
- Differential privacy enhancements for federated audit sharing
- Formal verification layer for high-stakes deployments
Issues and pull requests are welcome. Argos is intended to grow into the de facto open-source security standard for agentic AI systems. The attack signature library especially benefits from community contributions β if you discover a novel attack pattern, please open an issue.
Apache License 2.0 β see LICENSE.
The Apache 2.0 license includes an explicit patent grant clause, providing patent protection for adopters. This is important for security tooling intended for enterprise deployment.
If you use Argos in academic work:
@software{rawal2026argos,
author = {Rawal, Harshit},
title = {Argos: open-source runtime observability & integrity monitor for LangGraph Agents},
year = {2026},
url = {https://github.com/Vasco1290/Argos},
}Harshit Rawal
GitHub: @Vasco1290
LinkedIn: Harshit Rawal
Built to explore reliability, integrity, and observability patterns for production LangGraph deployments.