Credify
A robust Rust library for validating LinkedIn profile URLs with AI-first design. Built for the era of AI agents and LLMs, Credify provides both traditional validation APIs and specialized functions optimized for AI tool calling, especially with frameworks like Rig.
๐ฏ New in v0.3.0: Ergonomic Rig framework integration with ultra-simple async helpers that prevent runtime panics and provide clean, structured responses perfect for AI agents.
๐ Key Features
- ๐ค AI-First Design - Multiple API levels from simple booleans to rich structured data
- ๐ฏ Rig Framework Optimized - Ergonomic helpers designed specifically for Rig tools
- โก Async & Sync APIs - Full async support to prevent blocking runtime panics
- ๐ Structured Responses -
AIValidationResultwith confidence scores and decisions - ๐ Smart Validation - Format checking, existence verification, and intelligent fallbacks
- ๐ Rich Error Context - Detailed explanations with actionable suggestions
- ๐ก๏ธ Never Panics - Comprehensive error handling throughout
- ๐ High Performance - Optimized for concurrent operations
๐ฆ Installation
[]
= "0.3.0"
Or use cargo add:
๐ Quick Start
For AI Agents & Rig Framework (Recommended)
use ;
// Ultra-simple validation
if rig_is_valid.await
// Get a human-readable response
let message = rig_validate_text.await;
// Returns: "โ
Valid profile @johndoe (95% confidence)"
For Rig Tool Implementation
๐ API Overview
๐ฏ Ergonomic Rig Helpers (New!)
| Function | Returns | Use Case |
|---|---|---|
rig_is_valid() |
bool |
Quick true/false checks |
rig_validate_text() |
String |
One-line human-readable responses |
rig_validate_json() |
String |
Clean JSON for tool responses |
rig_validate() |
RigValidationResult |
Structured data with all details |
๐ค AI-Optimized Functions
| Function | Returns | Use Case |
|---|---|---|
ai_validate() |
AIValidationResult |
Full structured data |
ai_validate_json() |
String |
JSON for AI consumption |
validate_for_llm() |
String |
Verbose text reports |
๐ง Traditional API
| Function | Returns | Use Case |
|---|---|---|
is_valid_linkedin_profile_format() |
bool |
Format checking only |
LinkedInValidator::is_valid_linkedin_profile_url() |
Result<bool> |
Full validation |
๐ก Usage Examples
1. Rig Framework Integration (Recommended)
use ;
use Tool;
;
// Or use structured data
async
2. AI Agent Integration
use ;
async
3. Quick Validation
use is_valid_linkedin_profile_format;
// Format check only (no network calls)
if is_valid_linkedin_profile_format
// Full validation with network check
use LinkedInValidator;
let validator = new?;
match validator.is_valid_linkedin_profile_url
4. Async Operations
use validate_linkedin_url_async;
// Async validation
let is_valid = validate_linkedin_url_async.await?;
// Async with AI response
let json = ai_validate_json_async.await;
โ ๏ธ Important: Async Usage
When using Credify in async contexts (like web servers or AI frameworks), always use the async versions to avoid runtime panics:
// โ WRONG - Can cause panic in async context
async
// โ
CORRECT - Use async version
async
// โ
BEST - Use Rig helpers (always async)
async
๐ Response Types
RigValidationResult
AIValidationResult
๐ค Why AI-Friendly Validation Matters
Traditional validation returns simple true/false or error codes. AI agents need rich context to make intelligent decisions:
- Context-Rich Responses: Understand why validation failed
- Confidence Scores: Make nuanced decisions based on certainty
- Actionable Suggestions: Know what to do next
- Structured Data: Easy to parse and reason about
๐ ๏ธ Advanced Features
Custom User Agent
let validator = new_with_user_agent?;
Handling LinkedIn Authentication
LinkedIn often returns AUTH_REQUIRED (999 status) for valid profiles. Credify intelligently handles this:
// AUTH_REQUIRED is treated as a valid profile
let result = rig_validate.await;
if result.valid && result.status.contains
๐ More Examples
Check out the examples/ directory for:
basic.rs- Simple validation examplesrig_ergonomic.rs- Ergonomic Rig API showcaserig_integration.rs- Full Rig framework integrationbatch_validator.rs- Validate multiple URLs concurrentlyllm_simple.rs- LLM-friendly validation
Run examples with:
๐งช Testing
# Run all tests
# Run with verbose output
๐ License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ Acknowledgments
Built with โค๏ธ for the AI agent community. Special thanks to the Rig framework team for inspiring the ergonomic API design.