Skip to content

luminous-banking/aibom-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AIBOM Test Application

A comprehensive AI/ML application demonstrating integration with AWS Bedrock, AgentCore, and various AI frameworks for testing AI Bill of Materials (AIBOM) detection.

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        GitHub Actions CI/CD                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”            β”‚
β”‚  β”‚   Lint   β”‚β†’ β”‚   Test   β”‚β†’ β”‚ Security β”‚β†’ β”‚  Deploy  β”‚            β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              AWS Cloud                               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚                           VPC                                β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”‚
β”‚  β”‚  β”‚    ALB    │───▢│    ECS    │───▢│  Bedrock/AgentCoreβ”‚   β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚  Fargate  β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚
β”‚  β”‚                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚              β”‚   β”‚
β”‚  β”‚                         β”‚                    β–Ό              β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚   β”‚
β”‚  β”‚  β”‚  Lambda   β”‚    β”‚    S3     β”‚    β”‚  Knowledge Base   β”‚   β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚ DynamoDB  β”‚    β”‚  (OpenSearch)     β”‚   β”‚   β”‚
β”‚  β”‚        β”‚          β”‚   Redis   β”‚    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚   β”‚
β”‚  β”‚        β–Ό          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                            β”‚   β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                                             β”‚   β”‚
β”‚  β”‚  β”‚    API    β”‚                                             β”‚   β”‚
β”‚  β”‚  β”‚  Gateway  β”‚                                             β”‚   β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                             β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

aibom-test/
β”œβ”€β”€ .github/
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yml                 # CI pipeline (lint, test, security)
β”‚       β”œβ”€β”€ cd-deploy.yml          # CD pipeline (deploy to AWS)
β”‚       └── security-scan.yml      # Scheduled security scans
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── main.py                    # FastAPI application
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ bedrock-agent-staging.yaml
β”‚   └── bedrock-agent-production.yaml
β”œβ”€β”€ infrastructure/
β”‚   β”œβ”€β”€ app.py                     # CDK application entry
β”‚   β”œβ”€β”€ cdk.json                   # CDK configuration
β”‚   β”œβ”€β”€ requirements.txt           # CDK dependencies
β”‚   └── stacks/
β”‚       β”œβ”€β”€ network_stack.py       # VPC, subnets, security groups
β”‚       β”œβ”€β”€ security_stack.py      # IAM roles, secrets
β”‚       β”œβ”€β”€ storage_stack.py       # S3, DynamoDB, ElastiCache
β”‚       β”œβ”€β”€ compute_stack.py       # ECS, Lambda, API Gateway
β”‚       β”œβ”€β”€ bedrock_stack.py       # Bedrock agents, guardrails
β”‚       └── monitoring_stack.py    # CloudWatch, alarms
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy.sh                  # Main deployment script
β”‚   β”œβ”€β”€ deploy_bedrock_agent.py    # Bedrock agent deployment
β”‚   β”œβ”€β”€ setup-local.sh             # Local development setup
β”‚   └── run-security-scans.sh      # Security scanning
β”œβ”€β”€ tests/
β”‚   └── integration/               # Integration tests
β”œβ”€β”€ Dockerfile                     # Multi-stage Docker build
β”œβ”€β”€ docker-compose.yml             # Local development services
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ sample_bedrock_app.py          # Sample AI/ML code
└── README.md

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Docker & Docker Compose
  • AWS CLI configured
  • Node.js 18+ (for CDK)
  • Snyk CLI (for security scans)

Local Development

# 1. Clone and setup
git clone <repository-url>
cd aibom-test

# 2. Run setup script
./scripts/setup-local.sh

# 3. Update environment variables
cp env.example .env
# Edit .env with your credentials

# 4. Start the application
source venv/bin/activate
python -m uvicorn app.main:app --reload

Deploy to AWS

# Deploy infrastructure
./scripts/deploy.sh deploy-infra -e staging

# Deploy application
./scripts/deploy.sh deploy-app -e staging

# Deploy Bedrock agent
./scripts/deploy.sh deploy-agent -e staging

# Or deploy everything at once
./scripts/deploy.sh deploy-all -e staging

πŸ” Security

Snyk Integration

The project includes comprehensive Snyk security scanning:

  • SCA: Open-source dependency vulnerabilities
  • SAST: Code security analysis
  • IaC: Infrastructure as Code security
  • Container: Docker image vulnerabilities
  • AIBOM: AI Bill of Materials

Run scans locally:

./scripts/run-security-scans.sh

Required Secrets (GitHub Actions)

Secret Description
AWS_ACCESS_KEY_ID AWS access key
AWS_SECRET_ACCESS_KEY AWS secret key
AWS_DEPLOY_ROLE_ARN IAM role for deployments
SNYK_TOKEN Snyk API token
SLACK_WEBHOOK_URL Slack notifications (optional)

πŸ€– AI/ML Components

This application demonstrates usage of:

Libraries

  • LangChain & LangChain-AWS
  • PyTorch & TorchVision
  • TensorFlow & Keras
  • Hugging Face Transformers
  • LlamaIndex
  • spaCy
  • OpenAI SDK
  • Anthropic SDK

Models

  • AWS Bedrock: Claude, Titan, Llama, Mistral, Cohere
  • OpenAI: GPT-4o, DALL-E, Whisper, Embeddings
  • Anthropic: Claude 3.5 Sonnet, Claude 3 Opus
  • Hugging Face: BERT, GPT-2, Llama, Mistral, etc.

πŸ“Š API Endpoints

Endpoint Method Description
/health GET Health check
/invoke POST Invoke Bedrock model
/agent POST Invoke Bedrock Agent
/models GET List available models

πŸ”„ CI/CD Pipeline

CI Pipeline (on PR/push)

  1. Lint: Ruff, Black, isort, mypy
  2. Test: pytest with coverage
  3. Security: Snyk SCA, SAST
  4. Build: Docker image build & push to ECR

CD Pipeline (on merge to main)

  1. Deploy Infrastructure: CDK deploy
  2. Deploy Application: ECS service update
  3. Deploy Bedrock Agent: Agent configuration
  4. Integration Tests: API validation
  5. Notify: Slack notification

🏷️ Environment Variables

See env.example for all available configuration options.

Key variables:

# AWS
AWS_DEFAULT_REGION=us-east-1

# Bedrock
BEDROCK_AGENT_ID=your-agent-id
DEFAULT_CHAT_MODEL=anthropic.claude-3-5-sonnet-20241022-v2:0

# API Keys
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...

πŸ“ License

MIT License - see LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors