Skip to main content

Advanced Topics

Enabling the LLM Brain

The Brain organ works out-of-the-box with rule-based heuristics. Adding an LLM unlocks deeper pattern analysis and autonomous pipeline generation.

Setup

cp .env.template .env

Edit .env with your provider:

# Option 1: Ollama (local, free, sovereign) — recommended
LLM_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=llama3

# Option 2: NVIDIA NIM (free tier cloud)
LLM_PROVIDER=nvidia
NVIDIA_API_KEY=your_key_here

# Option 3: OpenAI (paid cloud fallback)
LLM_PROVIDER=openai
OPENAI_API_KEY=your_key_here

Restart the organism. The brain will automatically detect the LLM and switch from rule-based to hybrid mode.

What Changes with LLM

CapabilityRule-basedLLM-backed
Pipeline quarantine
Vital sign logging
Pattern analysis
Autonomous pipeline generation
Cortex memory synthesis
Natural language reasoning

The Full Organ Catalog (20+)

The starter kit has four organs. The full BioAgentic platform adds:

OrganModulePulse FrequencyRole
💭 Dreamsdreams.pyEvery 20th pulseOffline pattern synthesis during idle
🧬 DNAdna.pyOn birthPipeline genetics, genome registry
🧪 Geneticsgenetics.pyOn breedGene pool management, tournament selection
🍳 Breederbreeder.pyEvery 50th pulseEvolutionary reproduction of pipelines
🌐 Federationfederation.pyEvery 30th pulsePeer discovery, cross-organism breeding
👀 Perceptionperception.pyEvery 5th pulseCodebase awareness, file change detection
🔍 Code Indexcode_index.pyOn birthAnti-hallucination — indexes real codebase symbols
🧠 Neural Cortexneural_cortex.pyEvery 100th pulseEmbedding backfill for semantic memory search
📊 Working Memoryworking_memory.pyEvery pulseShort-term salience-gated buffer (capacity 64)
🎯 Reinforcementreinforcement.pyOn pipeline execOutcome ledger, reward/penalty tracking
📈 Growthgrowth.pyEvery 100th pulseComposite growth score, trajectory tracking
🎓 Skillsskills.pyEvery ~36 metabSkill crystallization from repeated success
🧩 Cognitive Biasescognitive_biases.pyEvery pulseAttention gating, mood-aware salience filtering
🦴 Skeletonskeleton.pyEvery pulseStructural invariant enforcement
🚔 Immune Patrolimmune_patrol.pyEvery pulseActive threat hunting, anomaly sweeps
🔗 Cortex Graphcortex_graph.pyEvery ~10 metabKnowledge graph edges, clustering
🌉 Cortex Bridgecortex_bridge.pyEvery 3rd pulseScans agent artifacts, publishes to shared cortex
🛡️ Bred Filterbred_filters.pyOn pipeline execPre/post-compile whitelist for bred pipelines

Each organ is a standalone Python module. Add them one at a time to your starter organism.

Architecture

main.py              ← FastAPI entry point (birth/death lifecycle)
organism.py ← The living runtime (heartbeat + pulse loop)
cortex.py ← Persistent memory engine
cortex_api.py ← REST API for memory access
brain.py ← Hybrid reasoning (rules + optional LLM)
immune.py ← Pipeline health monitoring
pipeline_engine.py ← Pipeline CRUD + sandboxed execution
sandbox.py ← Static analysis + runtime restriction
llm_client.py ← Optional LLM client (Ollama/NVIDIA/OpenAI)
sovereign_lang/ ← Sovereign Script compiler
lexer.py ← Tokenizer
parser.py ← Recursive descent parser → AST
codegen.py ← AST → Python code generator
pipelines/ ← Your .sov pipeline files
hello_world.sov ← Example pipeline

Security Warning

caution

The starter kit has no authentication. Do not expose it to the public internet without adding API key auth. The full engine ships with sovereign_auth.py — a production-grade bearer token system with trust tiers.

Running Tests

python -m pytest tests/ -v