Agentspy is an auditing tool for AI agent workflows, focused on:
- LLM traffic auditing from eCapture WebSocket events
- Command execution auditing (Claude Code / Gemini CLI) via eBPF
Chinese documentation is available in README.zh.md.
- Audits HTTP/1.x and HTTP/2 requests/responses (with SSE stream reassembly)
- Detects sensitive content (
password,token,sk-, etc.) - Audits shell/python commands triggered by agent tool calls
- Runs SSL audit and command eBPF audit as parallel modules
- Uses
bpf2goembedded BPF objects (no external userspace helper binary required)
cmd/agentspy/ # App entrypoint
internal/client/ # eCapture WS client (SSL/TLS audit pipeline)
internal/auditor/ # LLM + command audit logic
internal/ebpfcmd/ # eBPF command audit module (bpf2go loader)
internal/config/ # config.yaml loader/defaults
bpf/claude_cmd.bpf.c # eBPF C program
config.yaml # Runtime config
- Go 1.25+
- clang/llvm (for
bpf2go) - Linux kernel with eBPF support (for command audit module)
- Running eCapture service (for SSL audit module)
Edit config.yaml:
ssl:
enabled: true
ws_addr: "127.0.0.1:28257"
ws_origin: "http://localhost/"
retry_interval: "5s"
command_ebpf:
enabled: false
claude_bin: ""Notes:
- If
command_ebpf.claude_binis empty, Agentspy auto-discovers the binary using:whereis -b claude bun claude-code- fallback:
PATHlookup
- The uprobe symbol is fixed to
uv_spawn.
- Generate eBPF bindings (first time, or after changing
bpf/*.bpf.c):
go generate ./internal/ebpfcmd- Run:
go run ./cmd/agentspy -config ./config.yamlThe compose stack includes:
ecapture(equivalent to yourdocker runcommand)agentspy
Start:
docker compose up -d --buildStop:
docker compose downThe ecapture service runs with:
privileged: truenetwork_mode: host/lib/modulesand/usr/srcmounted read-only- command:
tls --ecaptureq=ws://127.0.0.1:28257/
Agentspy uses host networking and reads runtime config from ./config.yaml.
- SSL only:
ssl.enabled=true,command_ebpf.enabled=false - Command eBPF only:
ssl.enabled=false,command_ebpf.enabled=true - Both modules: set both
enabled=true
go test ./...- eBPF attachment typically requires root privileges.
- On some kernels, syscall symbol names may vary; tracepoints can be used as fallback.
- If auto-discovery fails, set
command_ebpf.claude_binexplicitly.