How manahilayaz/tripwire-agent-monitor works
Tripwire monitors an LLM agent during long ALFWorld tasks, aiming to flag suspicious behavior early from observable trajectory prefixes. The main workflow runs an agent against the environment, records each step, and applies deterministic Layer 1 rules; the README also describes a conditional LLM monitor and fused alarm. Trajectory representations and signal extraction support monitoring, while evaluation and annotation tooling support analysis. Some monitor and runner relationships are documented in the source index rather than fully shown in excerpts; the Layer 2 branch is README-only.
Main entry points: layer1.py Layer 1 monitor · batch_runner.py Batch runner · logger.py Trajectory logger · extractor.py Signal extractor
Components 21
Agent execution
- Batch CLI
scripts/run_batch.py - Batch runner
src/tripwire/runner/batch_runner.py - ALFWorld wrapper
src/tripwire/env/alfworld_env.py - ReAct agent
src/tripwire/agent/react_agent.py - Groq client
src/tripwire/agent/groq_client.py
Failure monitoring
- Layer 1 monitor
src/tripwire/monitors/layer1.py - Repeated-action rule
src/tripwire/monitors/rules.py - Failure rules
src/tripwire/monitors/failure_rules.py - Stagnation rule
src/tripwire/monitors/stagnation.py - LLM monitor
src/tripwire/monitors - Fused risk alarm
src/tripwire/monitors
Trajectory analysis
- Trajectory logger
src/tripwire/trajectory/logger.py - Record schema
src/tripwire/trajectory/schema.py - Action graph
src/tripwire/representation/graphectory.py - Language representation
src/tripwire/representation/langutory.py - Signal extractor
src/tripwire/signals/extractor.py
Research analysis
- Evaluation metrics
src/tripwire/eval/metrics.py - Episode annotation
scripts/annotate_episode.py
Other components
- Operator
- ALFWorld
- Groq API
Connections 20
- Operator → Batch CLI: runs batch
scripts/run_batch.py - Batch CLI → Batch runner: calls
scripts/run_batch.py - Batch runner → ALFWorld wrapper: creates environment
scripts/run_batch.py - ALFWorld wrapper → ALFWorld: steps tasks
src/tripwire/env/alfworld_env.py - Batch runner → ReAct agent: runs episodes
src/tripwire/runner/batch_runner.py - ReAct agent → Groq client: uses model client
src/tripwire/agent/react_agent.py - Groq client → Groq API: sends requests
src/tripwire/agent/groq_client.py - Batch runner → Trajectory logger: records episodes
src/tripwire/runner/batch_runner.py - Trajectory logger → Record schema: serializes records
src/tripwire/trajectory/logger.py - Signal extractor → Action graph: derives action features
src/tripwire/signals/extractor.py - Signal extractor → Language representation: derives language features
src/tripwire/signals/extractor.py - Layer 1 monitor → Repeated-action rule: evaluates
src/tripwire/monitors/layer1.py - Layer 1 monitor → Failure rules: evaluates
src/tripwire/monitors/layer1.py - Layer 1 monitor → Stagnation rule: evaluates
src/tripwire/monitors/layer1.py - Stagnation rule → Signal extractor: uses signals
src/tripwire/monitors/stagnation.py - Layer 1 monitor → LLM monitor: triggers when flagged
README.md - LLM monitor → Fused risk alarm: contributes risk score
README.md - Layer 1 monitor → Fused risk alarm: contributes risk score
README.md - Trajectory logger → Evaluation metrics: provides trajectories
- Trajectory logger → Episode annotation: provides episodes
scripts/annotate_episode.py