Expand description
Wire-level prompt introspection for LLM SDK calls.
agenttap records the exact request/response pairs flying out to your
LLM provider, with Authorization, x-api-key, and known credential
patterns scrubbed by default. v0.1 provides the data types and the
redactor; with the reqwest feature it also installs as a
[reqwest_middleware::Middleware].
§Quick start (manual recording)
use agenttap::{Tap, Redactor};
use serde_json::json;
let tap = Tap::new();
// Record manually after each call:
let req_headers: Vec<(String, String)> = vec![
("authorization".into(), "Bearer sk-ant-thiseekrit1234567890".into()),
("content-type".into(), "application/json".into()),
];
let resp_headers: Vec<(String, String)> = Vec::new();
tap.record(
"POST",
"https://api.anthropic.com/v1/messages",
req_headers,
Some(json!({"model": "claude", "messages": [{"role": "user", "content": "hi"}]})),
200,
resp_headers,
None,
420,
);
let last = tap.last().unwrap();
assert_eq!(last.request_headers["authorization"], "***REDACTED***");Structs§
- Redactor
- Scrubs sensitive headers and credential-shaped strings.
- Tap
- Records LLM SDK HTTP traffic with redaction.
- Tapped
Call - One captured request/response pair, redacted.
Constants§
- DEFAULT_
SENSITIVE_ HEADERS - Default lower-cased header names whose values are scrubbed.
- DEFAULT_
VALUE_ PATTERNS - Default regex patterns for credential-like strings inside bodies.
Functions§
- diff
- Unified diff of two captured request bodies. Useful for “why did this work yesterday and not today?”