Hands-on code, labs, and reference material by Omar Santos for building, securing, and operating AI agents in cybersecurity.
Python
248
298 commits
updated Oct 12, 2026
Hands-on code, labs, and reference material by Omar Santos for building, securing, and operating AI agents in cybersecurity.
This is the companion repository for several of Omar's training programs and publications:
[!TIP] Coming from a Pearson live training, video course, O'Reilly event, or book? Each part below maps to a module or chapter, and the scripts stand alone, so you can jump straight to the part you need. The code here may be newer than the recording or printed edition; this repository is the current version.
# Python 3.13+ and uv are required
uv sync --python python3.13
# Smoke-test the environment (runs offline)
uv run python part1_foundational_topics/huggingface_example.py
# Most other scripts need an OpenAI API key in your environment or a local .env file
export OPENAI_API_KEY="your-key-here"
Never commit API keys. .env is already in .gitignore.
The repository is structured with eight parts covering the spectrum from basic AI concepts to a specification for coordinating specialist agents through an authorized security assessment:
part1_foundational_topics/: Foundational examples covering chat models, embeddings (with TensorFlow Projector visualization), interactive chatbots, and integration with various model providers (OpenAI, Hugging Face, Ollama)part2_prompt_templates/: Advanced prompt engineering techniques, template systems, and structured prompting strategies for cybersecurity applicationspart3_prompt_chaining/: Sophisticated prompt chaining workflows using LangChain Expression Language (LCEL), including branching chains, parallel processing, and conditional logic for security incident analysis and threat huntingpart4_rag_examples/: Comprehensive Retrieval Augmented Generation implementations with vector databases (Chroma), text splitting strategies, embedding comparisons, metadata handling, and web scrapingpart5_agents_and_mcp_servers/: Advanced AI agents, tools integration, LangGraph workflows, agentic RAG, and Model Context Protocol (MCP) implementations for cybersecurity automationpart6_agentic_frameworks/: Security-team guides to six ready-made agentic frameworks (OpenClaw, Hermes, Agent Zero, OpenHands, Paperclip, Buzz): what each is, where it helps, and where it should stay outpart7_tokenomics/: What agents cost to run and how to measure it: context compounding, prompt caching, model routing, compaction, tool-schema overhead, batch processing, per-task budgets, and cost per accepted outcomepart8_multi-agent_harness_spec/: A vendor-neutral design specification (not runnable code) for a supervisor-led, human-gated security-assessment harness: scope, evidence, approval gates, and a kill switchThis repository provides a structured learning journey covering cutting-edge AI agent technologies and their applications in cybersecurity operations.
chat_model_basic.py)chatbot_example.py)embeddings/)
huggingface_example.py)ollama/)chunking_and_images.md)basic_rag_part1.py, basic_rag_part2.py)basic_rag_part3.py)text_splitting_deep_dive.py)embedding_deep_dive.py)web_scrape_basic.py)utils/embedding_cost_calculator.py)basic_agent_and_tools.py)basic_agent_and_tools_scanner.py)agent_deep_dive/agent_chat.py)agent_deep_dive/agent_docstore.py)langgraph/)
agentic_rag/)asm_example/)crewai_example/)deepagents_example/)mcp_servers_examples/)What each framework is, where it helps a security team, where it should stay out, and how to harden it. The overview also includes a side-by-side comparison, a "which one for which job" guide, a map of the 2026 CVEs and supply-chain incidents, and lab exercises:
openclaw/)hermes/)agent_zero/)openhands/)paperclip/)buzz/)Where the money goes in an agent, and the metric that matters (cost per accepted outcome, not cost per token):
01_context_growth.py)02_prompt_caching.py, 03_live_cache_check.py)04_cost_per_outcome.py)05_model_routing.py)06_tool_schema_overhead.py)07_token_budget_guard.py)08_batch_triage.py)docs/07_cyber_index.md)A specification for coordinating specialist agents through an authorized assessment lifecycle. It is inspired by Cisco DevNet's Foundry Security Spec: the deliverable is architecture, invariants, evidence, and safety controls. There is no scanner, payload, or service to run. Exploitation validation and post-exploitation impact are disabled by default and need a recorded human approval for every execution. Research for this part was done in October 2026.
safety-governance.md): scope manifest, approval gates G0–G3, lab isolation, budgets, append-only audit, and a kill switch. Read this first; it overrides any implementation choice.architecture.md): supervisor, planner, and narrow workers; shared evidence store; A2A-style task messages; MCP tool brokers that deny by defaultagents.yaml): capabilities, approval gates, and hard-stop triggersreferences.md): MCP, A2A, OWASP agentic risks, and how Parts 5–7 feed the designStart at part8_multi-agent_harness_spec/README.md.
Note: This is a living set of resources. Content is updated regularly as the tools, models, and threats change, so the code may be newer than the version shown in a recorded video or a printed book. If something in a book or recording no longer matches, the version in this repository is the current one.
[!WARNING] Some examples (nmap scanning, Agent Zero on Kali Linux, attack surface management, ethical hacking agents) act against real systems. Run them only against systems you own or are explicitly authorized to test, ideally in an isolated lab. Part 8 is a design specification, not a scanner: its validation and impact phases stay disabled unless a human grants a task-specific approval for a named lab target.
Report a vulnerability in this repository privately. See SECURITY.md. Do not open a public issue for a security report.
For any queries or further information, please contact:
Omar Santos
892 followers · starred Dec 2024
158 followers · starred Nov 2025
Hands-on code, labs, and reference material by Omar Santos for building, securing, and operating AI agents in cybersecurity.
Python
248
298 commits
updated Oct 12, 2026
Hands-on code, labs, and reference material by Omar Santos for building, securing, and operating AI agents in cybersecurity.
This is the companion repository for several of Omar's training programs and publications:
[!TIP] Coming from a Pearson live training, video course, O'Reilly event, or book? Each part below maps to a module or chapter, and the scripts stand alone, so you can jump straight to the part you need. The code here may be newer than the recording or printed edition; this repository is the current version.
# Python 3.13+ and uv are required
uv sync --python python3.13
# Smoke-test the environment (runs offline)
uv run python part1_foundational_topics/huggingface_example.py
# Most other scripts need an OpenAI API key in your environment or a local .env file
export OPENAI_API_KEY="your-key-here"
Never commit API keys. .env is already in .gitignore.
The repository is structured with eight parts covering the spectrum from basic AI concepts to a specification for coordinating specialist agents through an authorized security assessment:
part1_foundational_topics/: Foundational examples covering chat models, embeddings (with TensorFlow Projector visualization), interactive chatbots, and integration with various model providers (OpenAI, Hugging Face, Ollama)part2_prompt_templates/: Advanced prompt engineering techniques, template systems, and structured prompting strategies for cybersecurity applicationspart3_prompt_chaining/: Sophisticated prompt chaining workflows using LangChain Expression Language (LCEL), including branching chains, parallel processing, and conditional logic for security incident analysis and threat huntingpart4_rag_examples/: Comprehensive Retrieval Augmented Generation implementations with vector databases (Chroma), text splitting strategies, embedding comparisons, metadata handling, and web scrapingpart5_agents_and_mcp_servers/: Advanced AI agents, tools integration, LangGraph workflows, agentic RAG, and Model Context Protocol (MCP) implementations for cybersecurity automationpart6_agentic_frameworks/: Security-team guides to six ready-made agentic frameworks (OpenClaw, Hermes, Agent Zero, OpenHands, Paperclip, Buzz): what each is, where it helps, and where it should stay outpart7_tokenomics/: What agents cost to run and how to measure it: context compounding, prompt caching, model routing, compaction, tool-schema overhead, batch processing, per-task budgets, and cost per accepted outcomepart8_multi-agent_harness_spec/: A vendor-neutral design specification (not runnable code) for a supervisor-led, human-gated security-assessment harness: scope, evidence, approval gates, and a kill switchThis repository provides a structured learning journey covering cutting-edge AI agent technologies and their applications in cybersecurity operations.
chat_model_basic.py)chatbot_example.py)embeddings/)
huggingface_example.py)ollama/)chunking_and_images.md)basic_rag_part1.py, basic_rag_part2.py)basic_rag_part3.py)text_splitting_deep_dive.py)embedding_deep_dive.py)web_scrape_basic.py)utils/embedding_cost_calculator.py)basic_agent_and_tools.py)basic_agent_and_tools_scanner.py)agent_deep_dive/agent_chat.py)agent_deep_dive/agent_docstore.py)langgraph/)
agentic_rag/)asm_example/)crewai_example/)deepagents_example/)mcp_servers_examples/)What each framework is, where it helps a security team, where it should stay out, and how to harden it. The overview also includes a side-by-side comparison, a "which one for which job" guide, a map of the 2026 CVEs and supply-chain incidents, and lab exercises:
openclaw/)hermes/)agent_zero/)openhands/)paperclip/)buzz/)Where the money goes in an agent, and the metric that matters (cost per accepted outcome, not cost per token):
01_context_growth.py)02_prompt_caching.py, 03_live_cache_check.py)04_cost_per_outcome.py)05_model_routing.py)06_tool_schema_overhead.py)07_token_budget_guard.py)08_batch_triage.py)docs/07_cyber_index.md)A specification for coordinating specialist agents through an authorized assessment lifecycle. It is inspired by Cisco DevNet's Foundry Security Spec: the deliverable is architecture, invariants, evidence, and safety controls. There is no scanner, payload, or service to run. Exploitation validation and post-exploitation impact are disabled by default and need a recorded human approval for every execution. Research for this part was done in October 2026.
safety-governance.md): scope manifest, approval gates G0–G3, lab isolation, budgets, append-only audit, and a kill switch. Read this first; it overrides any implementation choice.architecture.md): supervisor, planner, and narrow workers; shared evidence store; A2A-style task messages; MCP tool brokers that deny by defaultagents.yaml): capabilities, approval gates, and hard-stop triggersreferences.md): MCP, A2A, OWASP agentic risks, and how Parts 5–7 feed the designStart at part8_multi-agent_harness_spec/README.md.
Note: This is a living set of resources. Content is updated regularly as the tools, models, and threats change, so the code may be newer than the version shown in a recorded video or a printed book. If something in a book or recording no longer matches, the version in this repository is the current one.
[!WARNING] Some examples (nmap scanning, Agent Zero on Kali Linux, attack surface management, ethical hacking agents) act against real systems. Run them only against systems you own or are explicitly authorized to test, ideally in an isolated lab. Part 8 is a design specification, not a scanner: its validation and impact phases stay disabled unless a human grants a task-specific approval for a named lab target.
Report a vulnerability in this repository privately. See SECURITY.md. Do not open a public issue for a security report.
For any queries or further information, please contact:
Omar Santos
892 followers · starred Dec 2024
158 followers · starred Nov 2025