$ show aliasrobotics/cai
This repository is the archived reference implementation of the CAI (Cybersecurity AI) framework by Alias Robotics. It is a comprehensive, open-source platform for building and deploying AI-powered offensive and defensive security automation. The codebase provides a full-stack agent framework including a Python SDK (Agent, Runner, tools, handoffs, guardrails, tracing, voice, MCP), a CLI/REPL with rich interactive features, a Textual-based TUI, a FastAPI REST API server, and a benchmarking suite (CAIBench) with cyber ranges and CTF challenges. The framework supports multiple LLM providers (OpenAI, LiteLLM, custom) and includes specialized agents for red teaming, blue teaming, bug bounty, DFIR, network analysis, and more. It also features continuous operations (24/7 autonomous loops), session management, cost tracking, and extensive refusal testing (400+ scenarios). While the repository is now archived and will not receive further updates, the SDK components (function_tool decorator, Handoff abstraction, tracing processors, voice pipeline) are well-crafted and could be extracted for reuse in other agent-based projects. The codebase is large and monolithic, with some global mutable state and test duplication, but overall demonstrates strong engineering practices in the cybersecurity AI domain.
The LLM identified 6 files worth highlighting for reuse:
Provides the `function_tool` decorator that converts Python functions into agent-callable tools with automatic JSON schema generation, strict mode enforcement (additionalProperties: false), custom error handling, and Pydantic model support. This is a reusable pattern for defining tool interfaces in any agent framework, not just CAI.
Implements the `Handoff` abstraction for routing between agents, with input validation via Pydantic models, `on_handoff` hooks, strict schema enforcement, and support for tool-based handoffs. This pattern is reusable for multi-agent orchestration in any conversational AI system.
Defines the `SpanProcessor` interface and concrete implementations (e.g., `BatchSpanProcessor`, `SimpleSpanProcessor`) for exporting trace data. This follows the OpenTelemetry processor pattern and can be extracted for use in any tracing system that needs batched or immediate export of spans.
Implements a global `ToolRegistry` that auto-registers tools from module imports, categorizes them by agent type, and provides API-key gating. The registry pattern with category-based filtering is reusable for any plugin or tool system that needs dynamic discovery and conditional availability.
Provides session context compaction and handoff generation for multi-agent conversations. It extracts security-relevant findings (IPs, CVEs, artifacts) from message history using regex patterns, builds an XML-style handoff block, and persists state via environment variables. This pattern is reusable for any multi-turn agent system that needs to pass summarized context between agents.
Implements a stateless input router for the TUI that parses user commands and returns `RouteDecision` dataclasses indicating target terminals, agent names, and command types. It supports CLI, chat, broadcast, and parallel patterns. The pure-logic router pattern is reusable for any multi-window or multi-agent UI system.