This repository contains all the source code, examples, and production-ready implementations from the book "AI Agents in Cybersecurity: A Practitioner's Guide. From Strategy to Implementation" by Nicolas Cravino (2025).
Whether you're a security analyst looking to automate SOC operations, a CISO planning AI strategy, or an engineer building defensive systems, this repository provides practical, tested code you can deploy immediately.
Get your first AI security agent running in 30 minutes:
# Clone the repository
git clone https://github.com/ai-agents-cybersecurity/complete.git
cd complete
# Install dependencies
pip install -r requirements.txt
# Run the quick-start agent
cd quick-start
python alert_triage_agent.pyai-agents-cybersecurity/
โโโ quick-start/ # 30-minute agent from Appendix A
โโโ chapter-examples/ # Code organized by book chapter
โ โโโ ch01-strategic/ # Strategic implementation examples
โ โโโ ch02-concepts/ # Core concepts and SPAR framework
โ โโโ ch03-architectures/# Agent architecture patterns
โ โโโ ch04-oversight/ # Human oversight (HITL/HOTL/HIC)
โ โโโ ch05-scaling/ # Enterprise scaling solutions
โ โโโ ch06-digital-twins/# Security simulations
โ โโโ ch07-predictive/ # Predictive defense systems
โ โโโ ch08-identity/ # Behavioral analytics
โ โโโ ch09-explainable/ # Explainable AI (XAI)
โ โโโ ch10-governance/ # Ethics and compliance
โ โโโ ch11-operations/ # Operationalizing agents
โ โโโ ch12-soc/ # SOC integration
โ โโโ ch13-monitoring/ # Monitoring and maintenance
โ โโโ ch14-trends/ # Future trends and roadmap
โ โโโ ch15-threats/ # Attack surface analysis
โ โโโ ch16-hardening/ # Security hardening
โโโ production-ready/ # Full production implementations
โ โโโ alert-triage/ # Complete alert triage system
โ โโโ threat-hunting/ # Autonomous threat hunter
โ โโโ incident-response/# IR orchestration platform
โ โโโ vulnerability-mgmt/# Predictive patching system
โโโ integrations/ # Third-party integrations
โ โโโ splunk/ # Splunk apps and dashboards
โ โโโ elastic/ # Elasticsearch integrations
โ โโโ sentinel/ # Microsoft Sentinel playbooks
โ โโโ crowdstrike/ # CrowdStrike EDR integration
โโโ docker/ # Containerized deployments
โโโ kubernetes/ # K8s manifests and Helm charts
โโโ terraform/ # Infrastructure as Code
โโโ tests/ # Comprehensive test suites
- Python 3.8 or higher
- Docker (for containerized deployments)
- Kubernetes cluster (for production deployments)
- API keys for AI services (OpenAI, Anthropic, etc.)
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install core dependencies
pip install -r requirements.txt
# Install development dependencies
pip install -r requirements-dev.txt# Install all production dependencies
pip install -r requirements-prod.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your API keys and configuration
# Run database migrations
python manage.py migrate
# Start the orchestrator
python orchestrator/main.py- SPAR Framework: Complete implementation of Sense-Plan-Act-Reflect lifecycle
- Multi-Agent Systems: Collaborative agent architectures
- Human Oversight: HITL, HOTL, and HIC patterns with kill switches
- Explainable AI: SHAP and LIME implementations for security decisions
- Alert Triage: Reduce false positives by 70%
- Threat Hunting: Autonomous threat detection with MITRE ATT&CK mapping
- Incident Response: Automated playbook execution with human gates
- Vulnerability Management: Predictive patching with EPSS integration
- SIEM platforms (Splunk, QRadar, Sentinel)
- EDR solutions (CrowdStrike, SentinelOne)
- Cloud providers (AWS, Azure, GCP)
- Ticketing systems (ServiceNow, Jira)
Each chapter folder contains:
README.md- Chapter overview and learning objectives- Code examples with inline documentation
- Configuration files and templates
- Test cases and validation scripts
Comprehensive API documentation is available at /docs/api/ including:
- Agent orchestration APIs
- Integration endpoints
- Webhook configurations
- Authentication methods
# Run unit tests
pytest tests/unit/
# Run integration tests
pytest tests/integration/
# Run security tests
python tests/security/vulnerability_scan.py
# Run performance tests
locust -f tests/performance/load_test.py# Build the container
docker build -t ai-security-agent .
# Run with docker-compose
docker-compose up -d# Deploy with kubectl
kubectl apply -f kubernetes/
# Or use Helm
helm install security-agent ./helm-charts/security-agentTerraform configurations for:
- AWS ECS/EKS deployment
- Azure Container Instances/AKS
- Google Cloud Run/GKE
Based on production deployments:
- Alert Processing: 10,000+ alerts/minute
- Response Time: <100ms for triage decisions
- Accuracy: 94% true positive rate
- Uptime: 99.99% availability SLA
- All code follows OWASP secure coding practices
- API keys and secrets managed via environment variables
- Role-based access control (RBAC) implemented
- Audit logging for all agent decisions
- Encrypted communication channels
- Regular dependency updates
We welcome contributions! Please see CONTRIBUTING.md for:
- Code of conduct
- Development setup
- Pull request process
- Coding standards
- Start with
quick-start/- Get an agent running - Study
chapter-examples/ch02-concepts/- Understand core concepts - Explore
chapter-examples/ch03-architectures/- Learn patterns
- Review
production-ready/- Full implementations - Examine
integrations/- Connect to your stack - Deploy with
docker/orkubernetes/
- Explore
chapter-examples/ch15-threats/- Attack patterns - Study
chapter-examples/ch09-explainable/- XAI methods - Contribute to
tests/- Improve validation
This project is licensed under the MIT License - see the LICENSE file for details.
- MITRE ATT&CKยฎ - Apache 2.0
- SHAP - MIT License
- LangChain - MIT License
- See THIRD_PARTY_LICENSES.md for complete list
- The cybersecurity community for continuous feedback
- Contributors who improved the code
- Organizations that tested in production
- Open source projects we build upon
- Book Website: https://aiagentscybersecurity.com
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@aiagentscybersecurity.com
โก Ready to transform your security operations with AI? Start with the quick-start guide and have your first agent running in 30 minutes!
"The future of cybersecurity isn't human OR machineโit's human AND machine, working together at unprecedented scale and speed." - Nicolas Cravino
