SwarmShield 🛡️
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 🛠️
-
Key Rotation
- Set appropriate rotation intervals
- Implement backup procedures
- Monitor rotation events
-
Storage
- Use secure storage paths
- Implement backup strategy
- Monitor storage usage
-
Logging
- Configure appropriate log levels
- Secure log storage
- Regular log analysis
-
Error Handling
- Implement proper error recovery
- Monitor error rates
- Set up alerts
Contributing 🤝
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create your feature branch
- Submit a pull request
Security 🔐
For security issues, please email security@swarms.ai rather than using issues.
Testing ✅
Run the comprehensive test suite:
python swarm_shield_tests.py
Support 💬
- Documentation: https://swarms.ai/docs
- Issues: GitHub Issues
- Discord: Join our community
- Email: support@swarms.ai
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
Metadata
Release files for swarm-shield 7.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarm_shield-7.0.0.tar.gz | 11.2 kB | Without provenance | Details for swarm_shield-7.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarm_shield-7.0.0-py3-none-any.whl | Python 3 | none | any | Details for swarm_shield-7.0.0-py3-none-any.whl |
Total release size: 20.9 kB
Release files / swarm_shield-7.0.0.tar.gz
| Download URL | swarm_shield-7.0.0.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
936cb0cf17c38b34e2e102cc9c1fb678422d0645ea116c0fcd0aea80693f156f
|
|
BLAKE2b-256 checksum How to use checksums |
511127927fb89265d9bc6849eb33c3189b49c52135c7f6381210987b0547f0db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.6 Darwin/23.3.0
|
Release files / swarm_shield-7.0.0-py3-none-any.whl
| Download URL | swarm_shield-7.0.0-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c3be40fd483f365e8e05d70087adf9225cc16addbdb910c9c8bed1b27203f65a
|
|
BLAKE2b-256 checksum How to use checksums |
e04260e4856f52b68c863b3faf23733b096812126a7baa122da2c29950a46985
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.6 Darwin/23.3.0
|
Security for swarm-shield 7.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.