CyberAg Documentation
This guide explains how to run CyberAg locally using Docker + LocalStack.
1. **Docker Desktop**
- Required for running LocalStack and Lambda execution
- Download from: https://www.docker.com/products/docker-desktop/
- Ensure Docker is running before starting CyberAg
2. **Node.js** (v20+)
- Required for the monorepo and all apps
- Download from: https://nodejs.org/
3. **Rust Toolchain** (for Tauri desktop app - optional)
- Required if you want to build the desktop app
- Install from: https://rustup.rs/
- On Windows: winget install Rustlang.Rustup
4. **GEMINI_API_KEY** (optional for read-only UI)
- Required for AI features (guardrail classification, red team, eval, ask, hardening)
- Get your key from: https://aistudio.google.com/app/apikey
- Set as environment variable:
- Windows PowerShell: $env:GEMINI_API_KEY="your_api_key_here"
- Linux/macOS: export GEMINI_API_KEY="your_api_key_here"
- Or copy scripts/local/gemini.key.example → scripts/local/gemini.key
- **Read-only mode:** $env:CYBERAG_LOCAL_SKIP_GEMINI="1" skips AI features but loads the full UI with seeded data
- Install: npm install -g awscli-local or download from AWS
If you've already deployed the infrastructure:
cd apps/console
npm run dev
Then open http://localhost:3002 in your browser.
This will:
1. Start LocalStack
2. Deploy infrastructure to LocalStack
3. Seed sample data
4. Start the console
npm run start:local
After completion, open http://localhost:3002.
npm run local:up
Wait for LocalStack to be ready (approximately 10-15 seconds).
This creates:
npm run local:deploy
This populates the database with sample data (mirroring the mock.ts file):
npm run local:seed
cd apps/console
npm run dev
Open http://localhost:3002 in your browser.
npm run local:down
This stops LocalStack, removes volumes, and starts fresh:
npm run local:reset
Then re-deploy:
npm run local:deploy
npm run local:seed
1. Install Rust toolchain (see above)
2. Install Tauri CLI:
```bash
npm install -g @tauri-apps/cli
```
npm run desktop:dev
npm run desktop:build
The built desktop app will be in apps/desktop/src-tauri/target/release/bundle/.
docker compose logs localstack to see errors 1. npm run local:up
2. npm run local:deploy
3. npm run local:seed
4. cd apps/console && npm run dev
curl http://localhost:4566/_localstack/health.env.localcurl http://localhost:4566/api/v1/health to test backendcurl https://generativelanguage.googleapis.com/v1beta/models?key=$env:GEMINI_API_KEY - apps/console/package.json (console port)
- apps/docs/package.json (docs port)
- docker-compose.yml (LocalStack port)
┌─────────────────┐
│ Tauri Desktop │ (optional)
└────────┬────────┘
│
▼
┌─────────────────┐
│ Console (Vite) │ :3002
└────────┬────────┘
│ HTTP
▼
┌─────────────────────────────────┐
│ LocalStack :4566 │
│ ┌──────────────────────────┐ │
│ │ API Gateway │ │
│ │ ├─ /api/v1/* │ │
│ │ └─ /guardrail/check │ │
│ └──────────┬───────────────┘ │
│ │ │
│ ┌──────────▼──────────────┐ │
│ │ Lambda Functions │ │
│ │ ├─ api │ │
│ │ ├─ eval │ │
│ │ ├─ guardrail-gateway │ │
│ │ ├─ connectors │ │
│ │ └─ replay │ │
│ └──────────┬──────────────┘ │
│ │ │
│ ┌──────────▼──────────────┐ │
│ │ Data Layer │ │
│ │ ├─ DynamoDB │ │
│ │ ├─ S3 (audit vault) │ │
│ │ ├─ EventBridge │ │
│ │ └─ SQS (eval queue) │ │
│ └──────────────────────────┘ │
└─────────────────────────────────┘
│
▼
┌─────────────────┐
│ Gemini API │ (external)
└─────────────────┘
VITE_CYBERAG_API_URL=http://localhost:4566
GEMINI_API_KEY=your_api_key_here
TABLE_NAME=cyberag-main (auto-configured by CDK)
AUDIT_VAULT_BUCKET=cyberag-audit-vault (auto-configured by CDK)
EVENT_BUS_NAME=cyberag-events
1. **Console** makes HTTP requests to LocalStack API Gateway
2. **API Lambda** routes requests and emits events to EventBridge
3. **EventBridge** triggers:
- **Eval Lambda** (via SQS) for red team, ask, hardening
- **Guardrail Lambda** for runtime checks
- **Connector Lambda** for sync operations
- **Replay Lambda** for decision replay
4. **Lambdas** read/write to:
- **DynamoDB** for persistent data
- **S3** for audit vault (tamper-evident storage)
5. **Gemini API** is called by:
- **Eval Lambda** for AI-powered evaluation
- **Guardrail Lambda** for safety classification
| Feature | Local (LocalStack) | Production (AWS) |
|---|---|---|
| Region | us-east-1 | eu-west-1 |
| Encryption | AWS-managed | KMS CMK |
| S3 Retention | 7 days | 365 days |
| Remove Policy | DESTROY | RETAIN |
| Auth | None (dev) | Cognito |
| Rate Limiting | None | WAF (2000 req/min) |
| Monitoring | Local logs | CloudWatch |
| Edge | N/A | CloudFront (us-east-1) |
docker compose logs -f localstack