Skip to content

Quickstart

Prerequisites

  • Python 3.10+
  • Redis 7.0+ (for state management and message passing)
  • OpenAI API key or Anthropic API key (for LLM-powered agents)

Installation

Option 1: Docker (Recommended)

# Clone the repository
git clone https://github.com/nasirquant/fractal-neural-engine
cd fractal-neural-engine

# Start all services
docker-compose up -d

# Verify the API is running
curl http://localhost:8000/health

Option 2: Local Development

# Clone the repository
git clone https://github.com/nasirquant/fractal-neural-engine
cd fractal-neural-engine

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Copy and configure environment
cp .env.example .env
# Edit .env with your API keys

# Start Redis
docker run -d -p 6379:6379 redis:7-alpine

# Run the API server
python main.py

Your First Epoch

An epoch is a complete simulation run with a defined objective, agent count, and tick limit.

curl -X POST http://localhost:8000/epochs \
  -H "Content-Type: application/json" \
  -d '{
    "num_agents": 10,
    "max_ticks": 100,
    "global_objective": "minimize_loss",
    "loss_function": "mse",
    "convergence_threshold": 0.01,
    "checkpoint_interval": 10,
    "agent_roles": ["explorer", "optimizer", "critic", "synthesizer", "coordinator"]
  }'

Response:

{
  "epoch_id": "ep_abc123",
  "status": "running",
  "config": {
    "num_agents": 10,
    "max_ticks": 100,
    "global_objective": "minimize_loss",
    "loss_function": "mse",
    "convergence_threshold": 0.01,
    "checkpoint_interval": 10,
    "agent_roles": ["explorer", "optimizer", "critic", "synthesizer", "coordinator"]
  }
}

Monitor Progress

REST Polling

# Check epoch status
curl http://localhost:8000/epochs/ep_abc123

# Get agent states
curl http://localhost:8000/epochs/ep_abc123/agents

# Get epoch result
curl http://localhost:8000/epochs/ep_abc123/result

Environment Variables

VariableRequiredDefaultDescription
OPENAI_API_KEYYes*-OpenAI API key for GPT models
ANTHROPIC_API_KEYYes*-Anthropic API key for Claude models
GOOGLE_API_KEYNo-Google API key
COHERE_API_KEYNo-Cohere API key
TOGETHER_API_KEYNo-Together AI API key
REDIS_URLNoredis://localhost:6379/0Redis connection string
FNSE_LOG_LEVELNoINFOLogging level (DEBUG, INFO, WARNING, ERROR)
FNSE_LOG_FORMATNojsonLog format (json or text)
FNSE_DEFAULT_MODELNogpt-4o-miniDefault LLM model for agents
FNSE_MODEL_TEMPERATURENo0.7Sampling temperature
FNSE_MAX_TOKENSNo2048Max tokens per completion

*At least one LLM API key is required.

Next Steps