REST API / 7 Endpoints

API Documentation

Complete reference for the ELO-AGI REST API. Health checks, cognitive chat, sandboxed Python REPL, benchmarks, and analysis.

Base URL

https://zedigital-elo-agi.fly.dev
Interactive Swagger Docs

All endpoints return JSON. Interactive Swagger/OpenAPI documentation is available at /docs on the API server.

Endpoints

GET /api/health

Health check endpoint. Returns the current status, uptime in seconds, and API version.

Rate limit: 30 requests/minute

cURL Example

bash
curl https://zedigital-elo-agi.fly.dev/api/health

Response

json
{
  "status": "ok",
  "uptime": 123.45,
  "version": "0.9.0"
}
GET /api/info

Returns detailed system information including module counts, tier breakdown, capabilities list, and author details.

Rate limit: 30 requests/minute

cURL Example

bash
curl https://zedigital-elo-agi.fly.dev/api/info

Response

json
{
  "name": "ELO-AGI (NEURO)",
  "version": "0.9.0",
  "module_count": 38,
  "tiers": {
    "cognitive": 20,
    "infrastructure": 6,
    "support": 5,
    "agi": 7
  },
  "capabilities": [
    "causal_reasoning",
    "compositional_abstraction",
    "continual_learning",
    "robustness",
    "language_understanding"
  ],
  "author": "Elvi Zekaj"
}
GET /api/modules

Returns an array of all 38 cognitive modules with their name, category, and description, plus the total count.

Rate limit: 30 requests/minute

cURL Example

bash
curl https://zedigital-elo-agi.fly.dev/api/modules

Response

json
{
  "modules": [
    {
      "name": "Global Workspace",
      "category": "Cognitive",
      "description": "GWT attention-gated broadcasting"
    },
    {
      "name": "Predictive Coding",
      "category": "Cognitive",
      "description": "Free Energy Principle, hierarchical predictions"
    }
    // ... 36 more modules
  ],
  "total": 38
}
POST /api/chat

Chat with the cognitive AI engine. Accepts a message and optional conversation history, returns a response with cognitive context.

Rate limit: 30 requests/minute

Request Body

json
{
  "message": "string (max 10000 characters)",
  "history": [
    { "role": "user", "content": "previous message" },
    { "role": "assistant", "content": "previous response" }
  ]
}

cURL Example

bash
curl -X POST https://zedigital-elo-agi.fly.dev/api/chat \
  -H 'Content-Type: application/json' \
  -d '{"message": "Explain causal reasoning", "history": []}'

Response

json
{
  "response": "Causal reasoning is the ability to identify...",
  "cognitive_context": {
    "modules_activated": ["reasoning", "language", "memory"],
    "processing_time_ms": 245,
    "confidence": 0.87
  }
}
POST /api/repl

Execute Python commands in a sandboxed REPL environment. Dangerous imports are blocked, with a 256MB memory limit and 10-second execution timeout.

Rate limit: 10 requests/minute Sandboxed execution

Request Body

json
{
  "command": "string (max 5000 characters)"
}

cURL Example

bash
curl -X POST https://zedigital-elo-agi.fly.dev/api/repl \
  -H 'Content-Type: application/json' \
  -d '{"command": "print(2 + 2)"}'

Response

json
{
  "output": "4\n",
  "error": null,
  "execution_time": 0.003
}

Sandbox Restrictions

  • -- Dangerous imports blocked (os, subprocess, sys, shutil, etc.)
  • -- 256MB memory limit per execution
  • -- 10-second execution timeout
  • -- No filesystem or network access
POST /api/benchmark

Run the cognitive benchmark suite. Optionally specify which categories to evaluate. Returns scores per category with an overall aggregate.

Rate limit: 10 requests/minute

Request Body

json
{
  "categories": ["causal_reasoning", "compositional"]  // optional
}

Valid Categories

causal_reasoning compositional continual_learning robustness language memory planning reasoning

cURL Example

bash
curl -X POST https://zedigital-elo-agi.fly.dev/api/benchmark \
  -H 'Content-Type: application/json' \
  -d '{"categories": ["causal_reasoning", "robustness"]}'

Response

json
{
  "results": {
    "categories": {
      "causal_reasoning": {
        "average_score": 0.85,
        "tests": 124,
        "passed": 124
      },
      "robustness": {
        "average_score": 0.71,
        "tests": 192,
        "passed": 192
      }
    },
    "overall_score": 0.78,
    "total_tests": 316
  }
}
POST /api/analyze

Run cognitive analysis on input text. Supports dual-process thinking, emotion analysis, and reasoning chain analysis.

Rate limit: 30 requests/minute

Request Body

json
{
  "text": "string (max 5000 characters)",
  "analysis_types": ["dual_process", "emotion", "reasoning"]
}

Analysis Types

dual_process

System 1 (fast/intuitive) vs System 2 (slow/analytical) thinking pathways

emotion

Affect spectrum, valence, arousal, and primary emotion detection

reasoning

Logical, analogical, and causal reasoning chain analysis

cURL Example

bash
curl -X POST https://zedigital-elo-agi.fly.dev/api/analyze \
  -H 'Content-Type: application/json' \
  -d '{"text": "The discovery filled me with wonder", "analysis_types": ["dual_process", "emotion"]}'

Response

json
{
  "analyses": {
    "dual_process": {
      "system1": {
        "response_time_ms": 42,
        "confidence": 0.78,
        "assessment": "Positive emotional content detected"
      },
      "system2": {
        "response_time_ms": 1180,
        "confidence": 0.91,
        "assessment": "Expression of epistemic emotion (wonder/awe)"
      },
      "integration": {
        "override": true
      }
    },
    "emotion": {
      "primary_emotion": "awe",
      "primary_score": 0.89,
      "valence": 0.82,
      "arousal": 0.65,
      "affect_spectrum": {
        "joy": 0.72,
        "surprise": 0.68,
        "anticipation": 0.45
      }
    }
  },
  "execution_time": 1.24
}

Ready to Integrate?

Try the interactive demo or explore the Swagger docs.