|
| 1 | +# Dagger Fraud Simulation Workflow |
| 2 | + |
| 3 | +This directory contains the [Dagger](https://dagger.io) module for the Fraud Simulation and AI Analysis pipeline. |
| 4 | + |
| 5 | +## Purpose |
| 6 | + |
| 7 | +The Dagger Workflow Pipeline automates the end-to-end fraud detection simulation: |
| 8 | +1. **Generation**: Spawns mock user accounts and login login events. |
| 9 | +2. **Simulation**: Processes logs through rule-based and AI-powered detections (Gemini & Groq). |
| 10 | +3. **Aggregation**: Summarizes results with per-account fraud scores and alerts. |
| 11 | +4. **AI Insights**: Analyzes the final summary report using Dagger's AI Agent to provide high-level insights and patterns. |
| 12 | + |
| 13 | +Using Dagger ensures this pipeline runs consistently across local development and GitHub Actions by encapsulating the environment in containers. |
| 14 | + |
| 15 | +## Local Usage |
| 16 | + |
| 17 | +### 1. View Available Functions |
| 18 | + |
| 19 | +To see the available functions and their documentation: |
| 20 | + |
| 21 | +```bash |
| 22 | +dagger functions |
| 23 | +``` |
| 24 | + |
| 25 | +Or for detailed help on a specific function: |
| 26 | + |
| 27 | +```bash |
| 28 | +dagger call run-fraud-sim --help |
| 29 | +``` |
| 30 | + |
| 31 | +### 2. Run Fraud Simulation |
| 32 | + |
| 33 | +To run the full simulation and export the results to a local file: |
| 34 | + |
| 35 | +```bash |
| 36 | +# Ensure your API keys are set as environment variables |
| 37 | +export GEMINI_API_KEY="your_key_here" |
| 38 | +export GROQ_API_KEY="your_key_here" |
| 39 | + |
| 40 | +dagger call run-fraud-sim \ |
| 41 | + --source . \ |
| 42 | + --gemini-api-key env:GEMINI_API_KEY \ |
| 43 | + --groq-api-key env:GROQ_API_KEY \ |
| 44 | + export --path results/summary.json |
| 45 | +``` |
| 46 | + |
| 47 | +**Note:** `env:GEMINI_API_KEY` tells Dagger to read the value from your host's environment variable and pass it securely as a secret. |
| 48 | + |
| 49 | +### 3. Run AI Result Analysis |
| 50 | + |
| 51 | +To generate AI insights from an existing summary report: |
| 52 | + |
| 53 | +```bash |
| 54 | +dagger call analyze-results --summary results/summary.json > results/insights.txt |
| 55 | +``` |
| 56 | + |
| 57 | +This command uses the `analyze_results` function which leverages Dagger's built-in LLM capabilities to review the summary and suggest remediations. |
| 58 | + |
| 59 | +## Automated Execution (CI) |
| 60 | + |
| 61 | +This module is triggered automatically via GitHub Actions in [.github/workflows/dagger-fraud-sim.yml](file:///Users/fayedraza/Authenication%20Service/.github/workflows/dagger-fraud-sim.yml) whenever the main CI pipeline completes successfully. |
0 commit comments