Overview

OilGas Nanobot Swarm is an open-source hierarchical multi-agent AI system for oil and gas engineering. It uses a 3-tier Queen → L1 Domain Leads → L2 Sub-Agents architecture to decompose complex engineering problems and deliver expert-level analysis.

ⓘ The public demo at oilgas-nanobot-swarm.vibecaas.app is fully functional with no authentication required. Try the Swarm Console directly.

Key Features

  • 7 built-in petroleum engineering calculators (drilling, reservoir, production, pipeline, well control, petrophysics, regulatory)
  • 9 pre-configured O&G agent teams with specialized workflows
  • AI Agent Builder and Team Builder — generate custom agents from natural language
  • OpenAI-compatible API — works with any OpenAI SDK client
  • NeuralQuantum.ai branded web dashboard with mobile support
  • Deployable to Vercel, Render, Railway, or Docker Compose

Quick Start

Option 1 — Use the live demo (no setup)

curl -X POST https://oilgas-nanobot-swarm.vibecaas.app/swarm/run \
  -H "Content-Type: application/json" \
  -d '{"goal": "Calculate ECD at 10,000 ft TVD, 10.5 ppg mud, 320 psi APL"}'

Option 2 — Deploy to Vercel

npm i -g vercel
git clone https://github.com/ttracx/oilgas-nanobot-swarm.git
cd oilgas-nanobot-swarm
vercel --prod
# Set OLLAMA_API_KEY in Vercel dashboard

Option 3 — Docker Compose (local)

git clone https://github.com/ttracx/oilgas-nanobot-swarm.git
cd oilgas-nanobot-swarm
cp .env.example .env   # add OLLAMA_API_KEY
docker compose up -d
curl http://localhost:8100/health

Architecture

The swarm uses a 3-tier hierarchy:

TierRoleCountResponsibility
L0Queen Orchestrator1Decomposes goals, assigns L1 tasks, synthesizes final answer
L1Domain Leads6Coder, Researcher, Analyst, Validator, Executor, Architect
L2Sub-Agents15Narrow specialists (planner, writer, searcher, critiquer, etc.)

The Vercel deployment uses a streamlined single-call API against Ollama Cloud or NVIDIA NIM. The full-stack deployment (Docker/Render/Railway) includes Redis state, knowledge vault, and background scheduler.

API Endpoints

Base URL: https://oilgas-nanobot-swarm.vibecaas.app

GET/healthPublic health check
POST/swarm/runDispatch engineering task (public demo)
POST/v1/chat/completionsOpenAI-compatible chat completions
POST/agent/buildGenerate agent config from description
POST/team/buildGenerate team config from description
GET/v1/modelsList available models
GET/swarm/topologyAgent hierarchy
GET/docsInteractive Swagger UI

Request Format

POST /swarm/run

{
  "goal": "Your engineering question (required, max 10,000 chars)",
  "mode": "hierarchical",   // or "flat" (optional)
  "team": "well-engineering-review",  // optional named team
  "metadata": {}            // optional context
}

POST /agent/build & /team/build

{
  "description": "Describe what you want (10–2000 chars)"
}

Response Format

POST /swarm/run response

{
  "success": true,
  "session_id": "nq-1772088336060",
  "goal": "...",
  "final_answer": "Step-by-step engineering analysis...",
  "subtask_count": 1,
  "duration_seconds": 7.6,
  "powered_by": "NeuralQuantum.ai"
}

POST /agent/build response

{
  "success": true,
  "type": "agent",
  "config": {
    "name": "production-decline-monitor",
    "mode": "hierarchical",
    "tools": ["production_engineering_calc", ...],
    "system_prompt": "You are...",
    "python_code": "from nanobot.scheduler...",
    "use_cases": [...],
    "example_goal": "..."
  },
  "duration_seconds": 6.1
}

Code Examples

Python (requests)

import requests

r = requests.post(
    "https://oilgas-nanobot-swarm.vibecaas.app/swarm/run",
    json={
        "goal": "Calculate kill mud weight. SIDPP=380 psi, MW=10.5 ppg, TVD=9800 ft",
        "team": "well-engineering-review"
    }
)
print(r.json()["final_answer"])

Python (OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://oilgas-nanobot-swarm.vibecaas.app/v1",
    api_key="demo",
)
response = client.chat.completions.create(
    model="nanobot-swarm",
    messages=[{"role": "user", "content": "Explain Archie's equation with an example"}],
)
print(response.choices[0].message.content)

JavaScript (fetch)

const res = await fetch(
  "https://oilgas-nanobot-swarm.vibecaas.app/swarm/run",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      goal: "Design frac program for Wolfcamp A: 8,500 ft lateral, target 2000 BOPD IP",
      team: "completions-design"
    })
  }
);
const data = await res.json();
console.log(data.final_answer);

cURL

curl -X POST https://oilgas-nanobot-swarm.vibecaas.app/swarm/run \
  -H "Content-Type: application/json" \
  -d '{"goal": "Run HSE PSM 14-element compliance audit for offshore platform"}'

Engineering Tools

All agents have access to these 7 built-in calculators. Reference them in goals or let the AI invoke them automatically.

Drilling Engineering

reservoir_pressure_calc
Hydrostatic gradient, BHP from wellhead, pore pressure, fracture gradient (Hubbert & Willis 1957), pressure gradient from density. Formula: FG = (ν/(1-ν)) × (OBG - PP) + PP
drilling_engineering_calc
ECD, kick tolerance, mud weight window, surge/swab. Formula: ECD = MW + APL / (0.052 × TVD)
well_control_calc
MAASP, kill mud weight, driller's method kill schedule. Formula: KMW = MW + SIDPP / (0.052 × TVD)

Reservoir & Petrophysics

production_engineering_calc
Productivity Index, Vogel IPR (11-point curve), Darcy radial flow, artificial lift selection. Reference: Vogel (1968): q/qmax = 1 - 0.2(Pwf/Pr) - 0.8(Pwf/Pr)²
formation_evaluation_calc
Archie water saturation (1942), Wyllie sonic porosity (1956), GR shale volume (linear), Timur permeability. Formula: Sw^n = (a × Rw) / (φ^m × Rt)

Midstream & Regulatory

pipeline_hydraulics_calc
Pressure drop (Darcy-Weisbach), flow regime (Reynolds number), line sizing, erosional velocity (API 14E). Formula: ΔP = f × (L/D) × (ρv²/2)
oilgas_regulatory_reference
API standards (6A, 16A, 570, 650), BSEE/BOEM 30 CFR 250, OSHA PSM 14 elements (29 CFR 1910.119), EPA Quad O/OOOOa, NORSOK D-010, ISO 16530.

Agent Teams

Use "team": "team-name" in your /swarm/run request to activate a pre-configured workflow.

Hierarchical
well-engineering-review
Casing design, ECD, kick tolerance, MAASP, regulatory compliance
Hierarchical
reservoir-analysis
IPR curves, Archie Sw, formation eval, volumetric reserves
Flat
drilling-ops-daily
Daily drilling report, NPT analysis, cost vs AFE tracking
Hierarchical
production-optimization
AI lift tuning, decline curves, waterflood performance
Hierarchical
pipeline-integrity
Corrosion assessment, ILI anomaly ranking, MAOP verification
Hierarchical
hse-compliance-audit
OSHA PSM 14 elements, BSEE SEMS, well integrity, EPA emissions
Hierarchical
well-economics
AFE, NPV10/IRR, break-even price, EUR sensitivity P10/P50/P90
Flat
oilgas-field-briefing
Daily ops briefing with production summary, safety, 24h plan
Hierarchical
completions-design
Frac stage design, proppant/fluid selection, cluster spacing, EUR

Custom Team Builder

Generate your own team from a description using the Builder UI or API:

curl -X POST https://oilgas-nanobot-swarm.vibecaas.app/team/build \
  -H "Content-Type: application/json" \
  -d '{"description": "Weekly waterflood performance review team that tracks injection rates, voidage replacement ratio, and pattern efficiency across all injectors"}'

Returns Python register_team(AgentTeam(...)) code ready to paste into your deployment.

Deployment — Vercel

Recommended for getting started. Static dashboard + Python serverless API. No server management.

Critical: vercel.json must use functions config

{
  "version": 2,
  "functions": { "api/index.py": { "maxDuration": 60 } },
  "rewrites": [
    { "source": "/", "destination": "/nanobot/static/index.html" },
    { "source": "/health", "destination": "/api/index.py" },
    { "source": "/swarm/:path*", "destination": "/api/index.py" },
    ...
  ]
}
⚠ Do NOT use "builds" config — it causes FUNCTION_INVOCATION_FAILED. Do NOT add handler = app — Vercel auto-detects FastAPI app.

Required environment variables

VariableRequiredDescription
OLLAMA_API_KEY✅ One of theseOllama Cloud API key (primary, ~3-5s)
NVIDIA_API_KEY✅ One of theseNVIDIA NIM API key (fallback)
GATEWAY_API_KEYOptionalAdmin endpoint auth key
⚠ Always set env vars with printf '%s' "value" | vercel env add KEY production — never use echo (adds trailing newline that breaks auth).

Render / Railway (Full Stack)

Includes Redis for session memory and background scheduler.

render deploy --config render.yaml
# or
railway up

Set: OLLAMA_API_KEY, NVIDIA_API_KEY, GATEWAY_API_KEY, ENABLE_OILGAS_TEAMS=true

Docker Compose (Local)

cp .env.example .env
# Edit .env — add OLLAMA_API_KEY
docker compose up -d
curl http://localhost:8100/health

Starts the FastAPI gateway on port 8100 and Redis on port 6379.

Adding a Custom Tool

Implement the BaseTool ABC in nanobot/tools/:

from nanobot.tools.base import BaseTool, ToolResult
import time

class MyTool(BaseTool):
    name = "my_calc"
    description = "Calculate [something]. Used for [when]."
    parameters_schema = {
        "type": "object",
        "properties": {
            "value": {"type": "number", "description": "Input in ppg"},
        },
        "required": ["value"],
    }

    async def run(self, value: float, **kwargs) -> ToolResult:
        start = time.time()
        result = value * 0.052
        return ToolResult(
            tool_name=self.name,
            success=True,
            output=f"Result: {result:.4f} psi/ft",
            raw={"result": result},
            duration_seconds=time.time() - start,
        )

Register it in nanobot/tools/oilgas_tools.pyget_oilgas_tools().

Adding a Custom Team

Register in nanobot/teams/oilgas_teams.py:

from nanobot.scheduler.agent_teams import AgentTeam, register_team

register_team(AgentTeam(
    name="my-team",
    description="One-line dashboard description",
    mode="hierarchical",  # or "flat"
    system_prompt="""You are the [Role] Team.

Workflow:
1. Use [tool_name] to [action]
2. Analyze results and synthesize

Output Format:
## Summary
## Findings
## Recommendations""",
    inject_knowledge=True,
    update_knowledge_after=True,
    max_tokens=4096,
    temperature=0.1,
))

Environment Variables

VariableDefaultDescription
OLLAMA_API_KEYOllama Cloud key
NVIDIA_API_KEYNVIDIA NIM key
ANTHROPIC_API_KEYClaude API key (full-stack)
ANTHROPIC_MODELclaude-sonnet-4-20250514Claude model ID
GATEWAY_API_KEYAdmin auth (optional)
REDIS_HOST127.0.0.1Redis host
REDIS_PORT6379Redis port
ENABLE_OILGAS_TEAMStrueLoad O&G teams on startup
VLLM_URLLocal vLLM endpoint (optional)
VAULT_PATH~/.nellie/vaultKnowledge vault path

⭐ Pro Edition Coming Soon

Full hierarchical swarm, Redis memory, knowledge vault, background scheduler, MS 365 integration, and dedicated support.

Contact Us View FAQ