use credify::validate_for_llm;
struct LinkedInValidatorTool;
impl LinkedInValidatorTool {
fn validate(&self, url: &str) -> String {
validate_for_llm(url)
}
}
fn main() {
println!("LinkedIn Profile Validator for AI Agents Example\n");
let tool = LinkedInValidatorTool;
let test_urls = vec![
(
"https://www.linkedin.com/in/johnsmith",
"Valid profile format",
),
("https://linkedin.com/in/jane-doe-123", "Valid with hyphens"),
("https://www.google.com/in/someone", "Wrong domain"),
(
"https://linkedin.com/company/microsoft",
"Company page, not profile",
),
("not-a-url", "Invalid URL format"),
];
for (url, description) in test_urls {
println!("=== Testing: {} ===", description);
println!("URL: {}\n", url);
let result = tool.validate(url);
let is_success = result.contains("VALIDATION_RESULT: SUCCESS");
let is_auth_required = result.contains("ERROR_TYPE: AUTH_REQUIRED");
if is_success {
println!("✅ AI Agent Decision: VALID PROFILE - Proceed with this URL");
} else if is_auth_required {
println!(
"✅ AI Agent Decision: LIKELY VALID - LinkedIn is blocking checks but URL format is correct"
);
println!(
" Recommendation: Treat as valid profile (LinkedIn auth walls usually mean real profiles)"
);
} else {
println!("❌ AI Agent Decision: INVALID - Search for a different URL");
}
for line in result.lines() {
if line.starts_with("VALIDATION_RESULT:")
|| line.starts_with("ERROR_TYPE:")
|| line.starts_with("RECOMMENDED_NEXT_STEP:")
{
println!(" {}", line);
}
}
println!("\n---\n");
}
println!("=== Special Case: LinkedIn Authentication Required ===\n");
println!("When LinkedIn returns AUTH_REQUIRED:");
println!("- The URL format is valid");
println!("- The profile LIKELY EXISTS");
println!("- LinkedIn is just blocking automated checks");
println!("- AI agents should ACCEPT these URLs as valid");
println!("\nThis is the most common response for real LinkedIn profiles!");
}