Skip to main content
Connic

Kafka Fraud Detector

By Connic

Score transactions for fraud in real-time on Kafka streams. Uses velocity analysis, geo-anomaly detection, and pattern matching per customer.

SecurityAdvancedKafka
connic init my-project --templates=kafka-fraud-detector

Overview

Consumes transactions from a Kafka topic and scores each for fraud risk using velocity analysis, geo-anomaly detection, and retrieval pattern matching. Conditional tools restrict admin_override access based on context. Concurrency control queues transactions by customer_id to prevent race conditions. High-risk alerts are formatted by a tool agent and published to a Kafka outbound topic.

Use cases

Payment fraud detection

Score every transaction in real-time for fraud signals like impossible travel, velocity spikes, and known patterns.

Risk-based routing

Route transactions to different review queues based on risk level: auto-approve, flag, hold, or block.

Pattern learning

Store novel fraud patterns in the retrieval so detection improves over time.

Architecture

Kafka (transactions)
fraud-scorer
Retrieval
fraud-escalator
Kafka (alerts)

Main template files

Install these files with connic init my-project --templates=kafka-fraud-detector. The CLI places agent definitions in a folder named after the template under agents/.

kafka-fraud-detector/
  agents/
    fraud-scorer.yaml
    fraud-escalator.yaml
  tools/
    fraud_tools.py
  middleware/
    fraud-scorer.py
  schemas/
    fraud-assessment.json
  requirements.txt
  README.md

Get started

Install the template, create a Connic project, and deploy through a connected Git repository or the CLI.

Prerequisites

  • Python 3.10+
  • A Connic account (create a project first)
  • Project credit for a connic/* model, or credentials for a BYOK provider
Create project
  1. Install and scaffold

    Install the SDK and create a project from this template.

    terminal
    pip install connic-composer-sdk
    connic init my-project --templates=kafka-fraud-detector

    Then cd my-project

  2. Deploy

    Choose a deployment method. A connected Git repository deploys on push; use the CLI for projects without a connected Git repository.

    Git integration
    1. In Connic: Project Settings → Git & Environments, connect the GitHub repository

    2. On the same page, map a branch (e.g. main) to the Production environment

    3. Push the scaffolded project to that repository

    terminal
    git add .
    git commit -m "Add Kafka Fraud Detector template"
    git push origin main
    CLI deploy
    1. In Connic: Project Settings → API Keys & MCP Auth, create an API key and copy project ID

    2. Run connic login in the project folder

    3. Use connic dev to try with hot-reload, connic test to run suites, or connic deploy for production

    terminal
    connic login
    connic dev     # Ephemeral dev env with hot-reload
    connic test    # Run declarative test suites
    connic deploy  # Deploy to production
  3. Connect and configure

    Add a Kafka inbound connector for the transactions topic and a Kafka outbound connector for fraud alerts. Configure bootstrap servers and optional SASL authentication. Use a connic/* model, or add BYOK credentials under Project Settings → LLM Provider.

Template source

Browse the full template, contribute improvements, or fork it for another use case.

connic-org/connic-awesome-agents/tree/main/kafka-fraud-detector

Information

Publisher
By Connic
Difficulty
Advanced
Works with
Kafka
Source
GitHub