Skip to main content

Overview

This API server provides HTTP endpoints for N8N workflows to interact with Airbais tools asynchronously. It supports job management, status tracking, and result retrieval for long-running analysis tasks.

Installation

1

Navigate to automation directory

bash cd automation
2

Install dependencies

bash pip install -r requirements.txt
3

Start the server

bash python api_server.py
The server will start on port 8888.

API Endpoints

Health Check

curl http://localhost:8888/health

Tool Analysis Endpoints

Start Analysis
POST http://localhost:8888/intentcrawler/analyze
Content-Type: application/json

{
  "url": "https://example.com"
}
IntentCrawler analyzes website content to discover user intents for LLM understanding.

Common Endpoints

Check Status
GET http://localhost:8888/status/{job_id}
Response
{
  "job_id": "uuid-here",
  "tool": "intentcrawler",
  "status": "running|completed|failed",
  "created_at": "2024-01-01T10:00:00",
  "updated_at": "2024-01-01T10:01:00",
  "completed_at": null
}
Get Results
GET http://localhost:8888/results/{job_id}
Response
{
  "job_id": "uuid-here",
  "tool": "intentcrawler",
  "status": "completed",
  "results": {
    "output_directory": "/path/to/results/2024-01-01",
    "files": {
      "dashboard_data": "/path/to/dashboard-data.json",
      "intent_report": "/path/to/intent-report.json"
    },
    "metrics": {
      "pages_analyzed": 150,
      "intents_discovered": 12
    }
  }
}

Common Issues

If you’re copying job IDs from terminal output, be careful not to include any trailing characters like backticks or quotes. The API will automatically clean common trailing special characters, but it’s best to copy only the UUID itself.
If you get a “tool not found” error, check that: 1. The tool name is correct in your endpoint URL 2. The API server has been restarted after configuration changes 3. The tool is properly configured in tools_config.yaml

Supported Tools

Testing Tools

Test scripts are provided for each tool:
python test_api.py https://example.com

Configuration

Tool configurations are managed in tools_config.yaml. This file contains tool definitions, server settings, and timeouts.

Adding New Tools

1

Edit Configuration

Update tools_config.yaml with your tool definition:
your_tool_name:
  name: "Your Tool Display Name"
  module_path: "your_tool_folder"
  script: "your_tool.py"
  description: "What your tool does"
  result_files:
    - "dashboard-data.json"
    - "your-report.json"
  required_params:
    - "url"
  optional_params:
    - "config"
    - "output"
  param_style: "flags"  # or "positional" or "config_file"
2

Restart Server

The API server will automatically pick up the new tool configuration on restart.

Parameter Styles

Default style - All parameters use --flag format
python tool.py --url https://example.com --verbose
Used by: GRASP Evaluator, GEO Evaluator

Server Settings

Edit the server section in tools_config.yaml:
server:
  port: 8888
  host: "0.0.0.0"
  debug: false
  cors_enabled: true

Response Formats

Start Analysis Response

{
  "job_id": "uuid-here",
  "status": "queued",
  "message": "Tool analysis started"
}

Status Response

{
  "job_id": "uuid-here",
  "tool": "toolname",
  "status": "running|completed|failed",
  "created_at": "2024-01-01T10:00:00",
  "updated_at": "2024-01-01T10:01:00",
  "completed_at": "2024-01-01T10:05:00"
}

Results Response

{
  "job_id": "uuid-here",
  "tool": "toolname",
  "status": "completed",
  "results": {
    "output_directory": "/path/to/results",
    "files": {
      "dashboard_data": "/path/to/dashboard-data.json"
    },
    "metrics": {
      "pages_analyzed": 150
    }
  }
}
The automation API provides a consistent interface for all Airbais tools, making it easy to integrate with N8N workflows and other automation platforms.