Skip to content

Quick Start

Nick edited this page Mar 10, 2026 · 4 revisions

Quick Start Guide

This guide will help you get PATAS up and running quickly.


Prerequisites

  • Python 3.10 or higher
  • SQLite (included) or PostgreSQL
  • Optional: OpenAI API key for semantic pattern mining

Installation

Using Poetry (Recommended)

# Clone repository
git clone https://github.com/KikuAI-Lab/PATAS.git
cd PATAS

# Install dependencies
poetry install

# Activate virtual environment
poetry shell

Using pip

# Clone repository
git clone https://github.com/KikuAI-Lab/PATAS.git
cd PATAS

# Install dependencies
pip install -e .

Configuration

  1. Copy the example environment file:
cp .env.example .env
  1. Edit .env with your settings:
# Database (SQLite by default)
DATABASE_URL=sqlite:///./data/patas.db

# Safety Profile
AGGRESSIVENESS_PROFILE=conservative

# LLM (optional, for semantic pattern mining)
LLM_PROVIDER=openai
OPENAI_API_KEY=your-key-here

See Configuration for complete configuration options.


Basic Usage

1. Ingest Messages

Load messages from logs or CSV:

# From your platform logs (example)
patas ingest-logs --source=your platform --since-days=7

# From CSV file
patas ingest-logs --source=csv --input=spam_logs.csv

2. Discover Patterns

Run pattern mining to discover spam patterns:

patas mine-patterns

This will:

  • Analyze ingested messages
  • Discover recurring patterns
  • Generate candidate rules
  • Store patterns and rules in database

3. Evaluate Rules

Evaluate rules in shadow mode (safe, non-production):

patas eval-rules

This evaluates all shadow rules against historical data and computes metrics.

4. Promote Rules

Promote good rules to active status:

patas promote-rules

This promotes rules that meet safety thresholds based on your aggressiveness profile.


your platform Integration

Run PoC (Proof of Concept)

patas-tg poc --input=examples/sample_your platform_logs.jsonl --out=./report

This will:

  • Load your platform log format
  • Run pattern mining
  • Evaluate rules
  • Generate a report in the output directory

See [Engineering Notes for integration](Engineering-Notes-for-your platform) for detailed integration guide.


API Server

Start the API server:

# Using Poetry
poetry run patas-api

# Or directly
patas-api

# Or with uvicorn
uvicorn app.api.main:app --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000.

See API Quickstart for API usage examples.


Safety Evaluation

Before deploying to production, always run safety evaluation:

patas safety-eval

This validates all profiles against safety thresholds. Do not deploy if this command fails.


Next Steps

  • Read Architecture to understand system design
  • Review Configuration for advanced settings
  • See [your platform Safety Guide](your platform-Safety-Guide) for production deployment
  • Check API Reference for API integration

Troubleshooting

See Configuration and Deployment for common issues and solutions.

Clone this wiki locally