Skip to content

akramIOT/Agentic-IAM

Repository files navigation

Agent Identity Framework

A comprehensive Python framework for managing agent identities, authentication, authorization, and trust in multi-agent systems.

Overview

This framework provides a complete solution for agent identity management with enterprise-grade security features, compliance support, and intelligent trust scoring.

Platform Overview New Note

System Architecture

Agentic-IAM Architecture Overview

┌─────────────────────────────────────────────────────────────┐
│                    Web Dashboard (Streamlit)                │
├─────────────────────────────────────────────────────────────┤
│                    REST API Layer (FastAPI)                 │
├─────────────────────────────────────────────────────────────┤
│                    Core IAM Engine                          │
│  ┌─────────────┬─────────────┬─────────────┬─────────────┐  │
│  │   Agent     │ Authentication│ Authorization│  Session │  │
│  │ Identity    │   Manager    │   Manager   │  Manager   │  │
│  └─────────────┴─────────────┴─────────────┴─────────────┘  │
│  ┌─────────────┬─────────────┬─────────────┬─────────────┐  │
│  │ Federated   │ Credential  │   Agent     │ Transport   │  │
│  │ Identity    │  Manager    │  Registry   │ Security    │  │
│  └─────────────┴─────────────┴─────────────┴─────────────┘  │
│  ┌─────────────┬─────────────┬─────────────────────────────┐│
│  │   Audit &   │ Intelligence│    Trust Scoring &          ││
│  │ Compliance  │   Engine    │  Behavioral Analytics       ││
│  └─────────────┴─────────────┴─────────────────────────────┘│
├─────────────────────────────────────────────────────────────┤
│              Data Layer (SQLite/PostgreSQL)                 │
└─────────────────────────────────────────────────────────────┘

Key Point

Key Components:

  • Frontend: Streamlit web dashboard for management
  • API Layer: FastAPI REST endpoints for integration
  • Core Engine: 10 integrated security modules
  • Data Layer: Persistent storage with encryption

Features

🔐 Core Identity Management

  • Agent Identity: UUID-based identities with metadata and cryptographic keys
  • Digital Signatures: Ed25519 and RSA support for identity verification
  • DID Support: Decentralized Identifier document generation

🔑 Authentication Subsystem

  • JWT Authentication: Secure token-based authentication
  • Cryptographic Auth: Challenge-response with digital signatures
  • mTLS Support: Mutual TLS certificate-based authentication
  • Multi-Factor Auth: Configurable multi-factor authentication flows

🛡️ Authorization Engine

  • RBAC: Role-Based Access Control with inheritance
  • ABAC: Attribute-Based Access Control with policy engine
  • PBAC: Policy-Based Access Control with custom rules
  • Hybrid Engine: Combine multiple authorization approaches

📋 Session Management

  • Secure Sessions: Token lifecycle with TTL and refresh
  • Audit Trails: Comprehensive session activity logging
  • Rate Limiting: Configurable limits and security policies
  • Multi-Session Support: Agent session limits and management

🌐 Federated Identity

  • OIDC Support: OpenID Connect integration
  • SAML Integration: SAML 2.0 identity provider support
  • DIDComm: Decentralized identity communication
  • Trust Brokers: Cross-domain trust relationships

🔒 Credential Management

  • Secure Storage: Encrypted credential vault with rotation
  • Key Rotation: Automated and policy-based rotation
  • Multiple Backends: In-memory and file-based storage
  • Credential Types: API keys, passwords, certificates, tokens

📖 Agent Registry

  • Discovery Service: Agent registration and lookup
  • Persistent Storage: SQLite and in-memory backends
  • Search & Filter: Advanced query capabilities
  • Audit Logging: Complete registry operation tracking

🚀 Transport Binding

  • Multi-Protocol: HTTP/HTTPS, gRPC, WebSocket, STDIO support
  • Security Enforcement: Transport-layer security policies
  • Identity Extraction: Automatic identity binding from requests
  • Rate Limiting: Per-agent and per-transport limits

📊 Audit & Compliance

  • Comprehensive Logging: All identity operations tracked
  • Compliance Frameworks: GDPR, HIPAA, SOX, PCI-DSS support
  • Integrity Verification: Cryptographic audit trail protection
  • Automated Reports: Compliance violation detection

🧠 Agent Intelligence

  • Trust Scoring: ML-based trust and reputation scoring
  • Anomaly Detection: Behavioral pattern analysis
  • Risk Assessment: Dynamic risk level calculation
  • Behavioral Profiling: Agent activity pattern learning

Quick Start

Installation

pip install -r requirements.txt

Basic Usage

from agent_identity import AgentIdentity, AgentMetadata, IdentityClaims
from authentication import JWTAuthentication, AuthenticationManager
from authorization import RBACEngine, Role
from session_manager import SessionManager, InMemorySessionStore, AuditLogger

# Create an agent identity
metadata = AgentMetadata(
    name="My Agent",
    agent_type="service_bot",
    version="1.0.0",
    organization="MyOrg"
)

claims = IdentityClaims(
    role="agent",
    permissions=["read", "write"],
    scopes=["user_data"]
)

agent = AgentIdentity(metadata=metadata, claims=claims)

# Set up authentication
auth_manager = AuthenticationManager()
jwt_auth = JWTAuthentication(secret_key="your-secret-key")
auth_manager.register_method("jwt", jwt_auth, is_default=True)

# Generate and verify token
token = jwt_auth.generate_token(agent)
result = auth_manager.authenticate({'token': token}, 'jwt')

print(f"Authentication successful: {result.success}")
print(f"Agent ID: {result.agent_id}")

Advanced Usage

from authorization import HybridAuthorizationEngine, Policy, PolicyRule, Effect
from session_manager import SessionManager
from agent_registry import AgentRegistry, InMemoryAgentStorage, RegistryAuditor
from credential_manager import CredentialManager, InMemoryCredentialStore, FernetEncryption
from audit_compliance import AuditManager, SQLiteAuditStorage, ComplianceFramework
from agent_intelligence import AgentIntelligenceEngine

# Set up comprehensive system
session_store = InMemorySessionStore()
session_manager = SessionManager(session_store)

registry_storage = InMemoryAgentStorage()
registry = AgentRegistry(registry_storage)

credential_store = InMemoryCredentialStore()
credential_encryption = FernetEncryption()
credential_manager = CredentialManager(credential_store, credential_encryption)

audit_storage = SQLiteAuditStorage("audit.db")
audit_manager = AuditManager(audit_storage)

intelligence_engine = AgentIntelligenceEngine()

# Register agent
registry.register_agent(
    agent,
    endpoints=["https://my-agent.example.com"],
    capabilities=["text_processing", "data_analysis"]
)

# Create session
from authentication import AuthenticationResult
auth_result = AuthenticationResult(success=True, agent_id=agent.agent_id, auth_method="jwt")
session_id = session_manager.create_session(agent, auth_result)

# Store credentials
api_key_id = credential_manager.store_credential(
    name="External API Key",
    credential_data="secret_api_key_123",
    credential_type=CredentialType.API_KEY,
    owner_agent_id=agent.agent_id
)

# Log audit event
audit_manager.log_event(
    AuditEventType.AUTH_SUCCESS,
    agent_id=agent.agent_id,
    session_id=session_id,
    details={"method": "jwt"}
)

# Calculate trust score
events = audit_manager.query_events(AuditQuery(agent_id=agent.agent_id))
trust_score = intelligence_engine.calculate_trust_score(agent.agent_id, events)

print(f"Trust Score: {trust_score.overall_score:.3f}")
print(f"Risk Level: {trust_score.risk_level.value}")

Architecture

Core Components

  1. AgentIdentity: Core identity representation with cryptographic keys
  2. Authentication: Multi-method authentication with JWT, signatures, mTLS
  3. Authorization: Flexible policy-based access control
  4. SessionManager: Secure session lifecycle management
  5. FederatedIdentity: Cross-domain identity federation
  6. CredentialManager: Secure credential storage and rotation
  7. AgentRegistry: Agent discovery and registration service
  8. TransportBinding: Protocol-agnostic identity binding
  9. AuditCompliance: Comprehensive audit logging and compliance
  10. AgentIntelligence: ML-based trust scoring and anomaly detection

Security Features

  • End-to-End Encryption: All sensitive data encrypted at rest and in transit
  • Digital Signatures: Cryptographic verification of agent actions
  • Zero Trust Architecture: Never trust, always verify approach
  • Audit Trails: Immutable audit logs with integrity verification
  • Anomaly Detection: ML-based behavioral analysis
  • Compliance: Built-in support for regulatory frameworks

Scalability

  • Modular Design: Use only the components you need
  • Pluggable Backends: Support for various storage systems
  • Async Support: Non-blocking operations where applicable
  • Caching: Intelligent caching for performance
  • Federation: Scale across trust domains

Configuration

Environment Variables

# Database configuration
AGENT_IDENTITY_DB_PATH=/path/to/database
AGENT_IDENTITY_ENCRYPTION_KEY=your-encryption-key

# Authentication configuration
JWT_SECRET_KEY=your-jwt-secret
JWT_TOKEN_TTL=3600

# Session configuration
SESSION_TTL=3600
MAX_SESSIONS_PER_AGENT=5

# Audit configuration
AUDIT_LOG_PATH=/path/to/audit.log
ENABLE_AUDIT_ENCRYPTION=true

# Compliance configuration
COMPLIANCE_FRAMEWORKS=gdpr,hipaa
DATA_RETENTION_DAYS=2555  # 7 years

Production Deployment

For production deployments, consider:

  1. Database Backend: Use PostgreSQL or MySQL instead of SQLite
  2. Redis Sessions: Use Redis for distributed session storage
  3. HSM Integration: Hardware Security Module for key management
  4. Load Balancing: Distribute across multiple instances
  5. Monitoring: Integrate with Prometheus/Grafana
  6. Backup Strategy: Regular encrypted backups
  7. Disaster Recovery: Multi-region deployment

Security Considerations

Best Practices

  1. Key Management: Use HSM or cloud KMS for production keys
  2. Secret Rotation: Implement automated credential rotation
  3. Network Security: Use TLS 1.3 for all communications
  4. Access Control: Follow principle of least privilege
  5. Monitoring: Implement real-time security monitoring
  6. Incident Response: Have procedures for security incidents
  7. Regular Audits: Conduct security assessments

Threat Model

The framework protects against:

  • Identity Spoofing: Cryptographic verification prevents impersonation
  • Credential Theft: Encrypted storage and rotation limit exposure
  • Session Hijacking: Secure session management with integrity checks
  • Privilege Escalation: Fine-grained authorization controls
  • Insider Threats: Comprehensive audit trails and anomaly detection
  • Compliance Violations: Automated compliance monitoring

Development

Running Tests

# Install development dependencies
pip install pytest pytest-asyncio coverage

# Run tests
pytest tests/

# Run with coverage
coverage run -m pytest tests/
coverage report

Code Quality

# Format code
black agent_identity/

# Check linting
flake8 agent_identity/

# Type checking
mypy agent_identity/

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Implement your changes with tests
  4. Ensure code quality checks pass
  5. Submit a pull request

Foundational Research & Academic AI Research References

This framework is inspired by and implements concepts from the following research:

Zero-Trust Identity for Agentic AI

A Novel Zero-Trust Identity Framework for Agentic AI: Decentralized Authentication and Fine-Grained Access Control
Ken Huang, Vineeth Sai Narajala, John Yeoh, Ramesh Raskar, Youssef Harkati, Jerry Huang, Idan Habler, Chris Hughes
arXiv:2505.19301 [cs.CR] - https://arxiv.org/abs/2505.19301

Agent Name Service (ANS): A Universal Directory for Secure AI Agent Discovery and Interoperability
Ken Huang, Vineeth Sai Narajala, Idan Habler, Akram Sheriff
arXiv:2505.10609 [cs.CR] - https://arxiv.org/abs/2505.10609

These papers provide the theoretical foundation for the zero-trust identity architecture, decentralized authentication mechanisms, and fine-grained access control systems implemented in this framework.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions:

Changelog

v1.0.0

  • Initial release with all core components
  • Full authentication and authorization support
  • Comprehensive audit and compliance framework
  • Agent intelligence and trust scoring
  • Multi-protocol transport binding
  • Federated identity support

Roadmap

Upcoming Features

  • GraphQL API interface
  • Kubernetes operator
  • Enhanced ML models for trust scoring
  • Additional compliance frameworks
  • Performance optimizations
  • Mobile agent support

About

Agentic Identity & Agentic Security System

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published