Metadata-Version: 2.1
Name: swarm-shield
Version: 6.8.8
Summary: Swarm Shield - TGSC
Home-page: https://github.com/The-Swarm-Corporation/swarm-shield
License: MIT
Keywords: artificial intelligence,deep learning,optimizers,Prompt Engineering,swarms,agents,llms,transformers,multi-agent,swarms of agents,Enterprise-Grade Agents,Production-Grade Agents,Agents,Multi-Grade-Agents,Swarms,Transformers,LLMs,Prompt Engineering,Agents,Generative Agents,Generative AI,Agent Marketplace,Agent Store,quant,finance,algorithmic trading,portfolio optimization,risk management,financial modeling,machine learning for finance,natural language processing for finance
Author: Kye Gomez
Author-email: kye@apac.ai
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Dist: cryptography
Requires-Dist: loguru
Project-URL: Documentation, https://docs.swarms.world
Project-URL: Repository, https://github.com/The-Swarm-Corporation/swarm-shield
Description-Content-Type: text/markdown

[![Multi-Modality](agorabanner.png)](https://discord.com/servers/agora-999382051935506503)

# SwarmShield 🛡️

[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)



[![PyPI version](https://badge.fury.io/py/swarms.svg)](https://badge.fury.io/py/swarms)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![Python Version](https://img.shields.io/badge/python-3.8%2B-blue)
[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://swarms.ai/docs)

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 📦

```bash
pip install swarms
```

## Quick Start 🏃‍♂️

```python
from swarms.security import SwarmShield, EncryptionStrength

# Initialize SwarmShield
shield = SwarmShield(
    encryption_strength=EncryptionStrength.MAXIMUM,
    key_rotation_interval=3600  # 1 hour
)

# Create a secure conversation
conversation_id = shield.create_conversation("Strategic Planning")

# Add encrypted messages
shield.add_message(conversation_id, "Agent1", "Mission parameters received")
shield.add_message(conversation_id, "Agent2", "Confirming execution plan")

# Retrieve conversation history
history = shield.get_messages(conversation_id)
for agent, message, timestamp in history:
    print(f"{timestamp} - {agent}: {message}")
```

## Security Features 🔒

### Encryption Levels

```python
# 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

```python
# 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

```python
# 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](CONTRIBUTING.md) 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:

```bash
python swarm_shield_tests.py
```

## Support 💬

- Documentation: [https://swarms.ai/docs](https://swarms.ai/docs)
- Issues: [GitHub Issues](https://github.com/kyegomez/swarms/issues)
- Discord: [Join our community](https://discord.gg/swarms)
- Email: support@swarms.ai

## License 📄

MIT License - see [LICENSE](LICENSE) for details.

## Creator 👨‍💻

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

---

Made with ❤️ by [Swarms.AI](https://swarms.ai)
