# CAI

> Open-source framework for building AI agents that test and defend security

- Category: Agents & Automation / Security Agents
- Language: Python
- Repository: https://github.com/aliasrobotics/cai
- Website: https://aliasrobotics.github.io/cai/
- Canonical page: https://ai-tldr.dev/tools/cai/

## In short

CAI (Cybersecurity AI) is a lightweight, open-source framework for building and running AI agents focused on security work. It gives researchers, ethical hackers, and IT teams the building blocks to create specialized agents that help with reconnaissance, vulnerability discovery, exploitation, and broader security assessment. It sits in the Security Agents category of the Agents & Automation tools and is open-source, written in Python.

## Overview

CAI (Cybersecurity AI) is a lightweight, open-source framework for building and running AI agents focused on security work. It gives researchers, ethical hackers, and IT teams the building blocks to create specialized agents that help with reconnaissance, vulnerability discovery, exploitation, and broader security assessment.

The framework is agent-centric and modular: you assemble agents, attach tools, and connect them with handoffs and reusable patterns. It works with more than 300 models through LiteLLM, so you can plug in providers such as OpenAI, Anthropic, DeepSeek, or a local Ollama model. CAI also includes guardrails against prompt injection and dangerous commands, plus integrated logging and tracing through Phoenix.

CAI ships as the pip package cai-framework and runs on Linux, macOS, Windows (via WSL), and Android. You can run it in open-source mode without an Alias license by setting an environment variable, using your own model provider keys.

## What it does

- Agent-based architecture: build modular, specialized agents for different security tasks and connect them with handoffs and reusable patterns
- 300+ model support via LiteLLM, including OpenAI, Anthropic, DeepSeek, and local Ollama models
- Built-in security tools for reconnaissance, exploitation, and privilege escalation, plus easy integration of your own tools
- Guardrails that defend against prompt injection and dangerous command execution
- Integrated logging and tracing through Phoenix for detailed traceability of agent runs
- Human-in-the-loop (HITL) controls so a person can stay in the loop during agent execution

## Getting started

CAI is distributed as the cai-framework package on PyPI. Install it into a Python 3.12 virtual environment, then launch the cai command. You can run it in open-source mode without an Alias license and bring your own model provider keys.

1. Create a virtual environment and install

   Set up a Python 3.12 virtual environment, activate it, and install the Community Edition from PyPI.

```bash
python3.12 -m venv cai_env
source cai_env/bin/activate && pip install cai-framework
```

2. Run without an Alias license

   Set CAI_LICENSE_OFF to bypass the license check and run in open-source mode, then start CAI. The first launch can take up to 30 seconds.

```bash
export CAI_LICENSE_OFF=1
cai
```

3. Configure your model and keys

   CAI loads settings from a .env file at launch. Choose a model with CAI_MODEL and supply the matching provider key. Note that OPENAI_API_KEY must not be left blank; use a placeholder like sk-1234 if you are using another provider.

```bash
OPENAI_API_KEY="sk-1234"
CAI_MODEL="openai/gpt-4o"
CAI_STREAM=False
```

## When to use it

- Building AI agents that assist with bug bounty work, from initial reconnaissance to vulnerability validation
- Running automated security assessments to discover and exploit vulnerabilities in target systems
- Researching and benchmarking how different LLMs perform on offensive and defensive cybersecurity tasks
- Practicing on CTF challenges and security labs with AI agents that keep a human in the loop
