Skip to main content

AutoMagik - Automated workflow management with LangFlow integration

Project description

AutoMagik

AutoMagik Logo

Because magic shouldn't be complicated.

AutoMagik is a workflow automation system that lets you run AI-driven flows from LangFlow with minimal fuss. Deploy tasks, monitor them, and iterate quickly—without writing a bunch of code.


Quick Setup

The easiest way to get started with AutoMagik is using our setup script. This will automatically set up all required services including PostgreSQL, the API, worker, and optionally LangFlow.

Prerequisites

  • Linux-based system (Ubuntu/Debian recommended)
  • Git (to clone the repository)
  • Python 3.10 or higher (will be installed automatically on Ubuntu/Debian if not present)
  • Docker and Docker Compose (will be installed automatically on Ubuntu/Debian if not present)

One-Command Setup

  1. Clone the repository:

    git clone https://github.com/namastexlabs/automagik.git
    cd automagik
    
  2. Run the setup script:

    ./scripts/setup_local.sh
    

That's it! The script will:

  • Create necessary environment files
  • Install Docker if needed (on Ubuntu/Debian)
  • Set up all required services
  • Install the CLI tool (optional)
  • Guide you through the entire process

Once complete, you'll have:

  • AutoMagik API running at http://localhost:8888
  • PostgreSQL database at localhost:15432
  • Worker service running and ready to process tasks
  • LangFlow UI at http://localhost:17860 (if installed)
  • CLI tool installed in a virtual environment (if chosen)

Verify Installation

The setup script automatically verifies all services. You can also check manually:

# Check API health
curl http://localhost:8888/health

# Access API documentation
open http://localhost:8888/api/v1/docs  # Interactive Swagger UI
open http://localhost:8888/api/v1/redoc # ReDoc documentation

# List flows (if CLI is installed)
source .venv/bin/activate
automagik flow list

What's Included

  • API Server: Handles all HTTP requests and core logic
  • Worker: Processes tasks and schedules
  • Database: PostgreSQL with all required tables automatically created
  • LangFlow (optional): Visual flow editor for creating AI workflows
  • CLI Tool (optional): Command-line interface for managing flows and tasks

Development Setup

For development, use the development setup script instead:

./scripts/setup_dev.sh

This will:

  • Set up a development environment with additional tools
  • Configure git hooks for code quality
  • Install development dependencies
  • Use development-specific configurations

Environment Configuration

The setup creates two main environment files:

  • .env: Your local configuration
  • .env.example: Template for reference

Key environment variables:

  • AUTOMAGIK_API_KEY: API authentication key
  • DATABASE_URL: PostgreSQL connection string
  • LANGFLOW_API_URL: LangFlow instance URL
  • AUTOMAGIK_DEBUG: Enable debug mode (0/1)
  • LOG_LEVEL: Logging verbosity (DEBUG/INFO/WARNING/ERROR)

Project Structure

flowchart LR
    subgraph Services
      A[PostgreSQL] & B[LangFlow]
    end
    subgraph AutoMagik
      E[CLI] -- Commands --> D[API]
      D -- Database --> A
      D -- Flows --> B
      F[Worker] -- Tasks --> D
    end
  • API: Core service handling requests and business logic
  • Worker: Processes tasks and schedules
  • CLI: Command-line tool for managing flows and tasks
  • PostgreSQL: Stores flows, tasks, schedules, and other data
  • LangFlow: Optional service for creating and editing flows

Using the CLI

AutoMagik comes with a powerful CLI tool for managing flows, tasks, and schedules. Here are some common commands:

Flow Management

# List all flows
automagik flow list

# View flow details
automagik flow view FLOW_ID

# Sync a flow from LangFlow
automagik flow sync FLOW_ID

# Delete a flow
automagik flow delete FLOW_ID

Task Management

# List all tasks
automagik task list

# Create a new task
automagik task create FLOW_ID --input '{"key": "value"}'

# View task details
automagik task view TASK_ID

# Retry a failed task
automagik task retry TASK_ID

Schedule Management

# List all schedules
automagik schedule list

# Create a schedule (runs daily at midnight)
automagik schedule create FLOW_ID "0 0 * * *"

# Update schedule expression
automagik schedule set-expression SCHEDULE_ID "*/15 * * * *"

# Enable/disable a schedule
automagik schedule update SCHEDULE_ID --enabled true

# Delete a schedule
automagik schedule delete SCHEDULE_ID

API and Worker Management

# Start the API server
automagik api

# Start the worker
automagik worker start

# Stop the worker
automagik worker stop

# Check worker status
automagik worker status

API Endpoints

The API is organized under the /api/v1 prefix and includes these main endpoints:

  • Flows: /api/v1/flows

    • GET /api/v1/flows: List all flows
    • POST /api/v1/flows: Create a new flow
    • GET /api/v1/flows/{id}: Get flow details
    • DELETE /api/v1/flows/{id}: Delete a flow
  • Tasks: /api/v1/tasks

    • GET /api/v1/tasks: List all tasks
    • POST /api/v1/tasks: Create a new task
    • GET /api/v1/tasks/{id}: Get task details
    • POST /api/v1/tasks/{id}/run: Run a task
  • Schedules: /api/v1/schedules

    • GET /api/v1/schedules: List all schedules
    • POST /api/v1/schedules: Create a schedule
    • GET /api/v1/schedules/{id}: Get schedule details
    • DELETE /api/v1/schedules/{id}: Delete a schedule

For full API documentation, visit:

Logs and Monitoring

  • API logs: Available through Docker Compose logs
  • Worker logs: Configured via AUTOMAGIK_WORKER_LOG (default: logs/worker.log)
  • Database logs: Available through Docker Compose logs

View all logs:

docker compose -p automagik -f docker/docker-compose.yml logs -f

Stopping Services

To stop all services:

docker compose -p automagik -f docker/docker-compose.yml down

Next Steps

  1. If you installed LangFlow, visit http://localhost:17860 to create your first flow
  2. Use the API at http://localhost:8888/api/v1/docs to manage your flows and tasks
  3. Try out the CLI commands with automagik --help
  4. Monitor task execution through logs and API endpoints

For more detailed documentation, check out the docs/ directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

automagik-0.1.0.tar.gz (375.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

automagik-0.1.0-py3-none-any.whl (53.0 kB view details)

Uploaded Python 3

File details

Details for the file automagik-0.1.0.tar.gz.

File metadata

  • Download URL: automagik-0.1.0.tar.gz
  • Upload date:
  • Size: 375.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for automagik-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4a8d99b8b4c09c2110a1b9ad4749e306ae55a7ae54f82320032ffe38db7b377d
MD5 b0974c7860a79f3f0163e1a19c3ae9bd
BLAKE2b-256 f5b53933d40874b1186ff7202e801f34bf23a36b6a4322011fd4e5515b13a8b6

See more details on using hashes here.

File details

Details for the file automagik-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: automagik-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for automagik-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3af28bb8555aae1c2690afbe5e537f245b6343260765328173da351bc2e06458
MD5 e0ab73b7b1b2e548f41898abb11bee98
BLAKE2b-256 6ce85f5d9bb7ec528cf566ed6961338ad679bc247503e4ca3c0cb6a224872d6f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page