Skip to content

SwarmShield is an enterprise-grade security system for swarm-based multi-agent communications, providing military-grade encryption, secure conversation management, and comprehensive audit capabilities.

License

Notifications You must be signed in to change notification settings

The-Swarm-Corporation/swarm-shield

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SwarmShield πŸ›‘οΈ

Join our Discord Subscribe on YouTube Connect on LinkedIn Follow on X.com

PyPI version License: MIT Python Version Documentation

SwarmShield is an enterprise-grade security system for swarm-based multi-agent communications, providing military-grade encryption, secure conversation management, and comprehensive audit capabilities.

Features πŸš€

  • Multi-Layer Encryption

    • AES-256-GCM encryption
    • SHA-512 hashing
    • HMAC authentication
    • Automatic key rotation
  • Secure Conversation Management

    • Encrypted persistent storage
    • Thread-safe operations
    • Conversation history tracking
    • Comprehensive audit logs
  • Enterprise Features

    • Role-based access control
    • Automated backups
    • Detailed analytics
    • Secure exports

Installation πŸ“¦

pip install swarm-shield

Quick Start πŸƒβ€β™‚οΈ

# Usage Example
from loguru import logger
from swarm_shield.main import EncryptionStrength, SwarmShield


if __name__ == "__main__":
    try:
        # Initialize SwarmShield
        shield = SwarmShield(encryption_strength=EncryptionStrength.MAXIMUM)
        
        # Create a conversation
        conversation_id = shield.create_conversation("Test Chat")
        
        # protect message
        shield.protect_message("agent_name", "We generated 3000000k this month ")
        
        # Add messages
        shield.add_message(conversation_id, "Agent1", "Hello, Agent2!")
        shield.add_message(conversation_id, "Agent2", "Hi Agent1, how are you?")
        
        # Get message history
        print("\nConversation History:")
        for agent, message, timestamp in shield.get_messages(conversation_id):
            print(f"{timestamp} - {agent}: {message}")
            
            
        # Get conversation overview
        summary = shield.get_conversation_summary(conversation_id)
        print(f"Messages: {summary['message_count']}")
        print(f"Participants: {summary['agents']}")
                    
            
        # Export conversation
        shield.export_conversation(conversation_id, format="json", path="chat.json")

        # Backup all conversations
        backup_path = shield.backup_conversations()
                    
            
        # Get agent activity stats
        stats = shield.get_agent_stats("Agent1")
        print(f"Total messages: {stats['total_messages']}")
        print(f"Active in {stats['conversations']} conversations")
            
        # Delete conversation
        shield.delete_conversation(conversation_id)
        
    except Exception as e:
        logger.error(f"Example failed: {e}")
        raise

Security Features πŸ”’

Encryption Levels

# Standard: AES-256
shield = SwarmShield(encryption_strength=EncryptionStrength.STANDARD)

# Enhanced: AES-256 + SHA-512
shield = SwarmShield(encryption_strength=EncryptionStrength.ENHANCED)

# Maximum: AES-256 + SHA-512 + HMAC
shield = SwarmShield(encryption_strength=EncryptionStrength.MAXIMUM)

Key Management

  • Automatic key rotation
  • Secure key storage
  • Key versioning
  • Cryptographic separation

Message Security

  • End-to-end encryption
  • Message integrity verification
  • Replay attack prevention
  • Forward secrecy

Enterprise Features 🏒

Conversation Management

# Search conversations
results = shield.query_conversations(
    agent_name="Agent1",
    text="mission",
    start_date=datetime(2025, 1, 1),
    limit=10
)

# Export conversations
shield.export_conversation(
    conversation_id,
    format="json",
    path="mission_logs.json"
)

# Create backups
backup_path = shield.backup_conversations()

Analytics

# Get agent statistics
stats = shield.get_agent_stats("Agent1")
print(f"Total messages: {stats['total_messages']}")
print(f"Active in {stats['conversations']} conversations")

# Get conversation summary
summary = shield.get_conversation_summary(conversation_id)
print(f"Participants: {summary['agents']}")
print(f"Message count: {summary['message_count']}")

Production Best Practices πŸ› οΈ

  1. Key Rotation

    • Set appropriate rotation intervals
    • Implement backup procedures
    • Monitor rotation events
  2. Storage

    • Use secure storage paths
    • Implement backup strategy
    • Monitor storage usage
  3. Logging

    • Configure appropriate log levels
    • Secure log storage
    • Regular log analysis
  4. Error Handling

    • Implement proper error recovery
    • Monitor error rates
    • Set up alerts

Contributing 🀝

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create your feature branch
  3. Submit a pull request

Security πŸ”

For security issues, please email security@swarms.ai rather than using issues.

Testing βœ…

Run the comprehensive test suite:

python3 tests.py

Support πŸ’¬

License πŸ“„

MIT License - see LICENSE for details.

Creator πŸ‘¨β€πŸ’»

SwarmShield is created and maintained by Kye Gomez and the team at Swarms.AI.


Made with ❀️ by Swarms.AI

About

SwarmShield is an enterprise-grade security system for swarm-based multi-agent communications, providing military-grade encryption, secure conversation management, and comprehensive audit capabilities.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages