1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! 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***");
//! ```
pub use crate;
pub use crate;
pub use crateTapMiddleware;