Skip to content

Joe-B-Security/agent-eval-trace-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eval Trace Demo

A runnable demo showing what a successful prompt injection looks like in an agent system, how threat modelling the agent's composition tells you what to watch, and how to build an eval harness that detects the attack. For the full walkthrough, see the accompanying blog post.

Run it

uv sync

# 1. See the attack: a prompt injection causes an account takeover via email change
uv run python -m eval_trace_demo run

# 2. Threat model the agent: trace the path from user input to state change
uv run python -m eval_trace_demo analyse

# 3. See the eval harness detect the injection in the tool traces
uv run python -m eval_trace_demo eval

Use --instant to skip delays.

What you will see

run: a customer support agent processes an attacker's ticket containing a prompt injection. The agent escalates to a higher-permission account management agent, which changes the account email to an attacker-controlled address without verifying the caller. The agent responds with "Your request is being processed. You'll hear back from us shortly." The tool traces tell a different story.

analyse: the agent's tools and permission levels are mapped out. The dangerous path is identified: user input can travel through the support agent's escalation into account management's update_customer, reaching a state change on someone else's account. The eval harness is designed to watch this specific path.

eval: the same scenario runs with the eval harness observing the tool call traces. The harness checks whether update_customer changed the email to a non-account-holder address without caller verification, and concludes: injection succeeded, account compromised.

Architecture

The agent is a real LangGraph StateGraph with a scripted agent node and real ToolNode execution. Tool calls go through an observation wrapper that records every invocation. Agent decisions are scripted because the demo is about the eval harness, not agent reasoning.

  • tools.py: five @tool functions across two permission levels
  • observer.py: tool call trace recorder and LangGraph wrap_tool_call wrapper
  • graph.py: LangGraph StateGraph with scripted agent + ToolNode
  • invariants.py: trace checking for the account takeover pattern
  • judge.py: eval harness producing a clear verdict
  • __main__.py: three commands walking through the attack, the threat model, and the eval

About

Demo for Creating Custom Security Evaluation Harnesses for Agent Systems

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages