Skip to main content

Aragora Developer Quick Start

Quick reference for developers working with Aragora

Project Structure

aragora/
├── agents/ # Agent implementations (CLI, API)
├── debate/ # Core debate engine
│ ├── orchestrator.py # Arena class (main coordinator)
│ ├── phases/ # Modular phase executors
│ └── context.py # Shared debate state
├── memory/ # Memory systems
│ ├── continuum/ # Multi-tier memory (fast/medium/slow/glacial)
│ ├── consensus.py # Topic consensus tracking
│ └── postgres_*.py # PostgreSQL implementations
├── ranking/ # ELO rating system
│ ├── elo.py # SQLite-based EloSystem
│ └── postgres_database.py # PostgreSQL EloDatabase
├── server/ # HTTP/WebSocket API
│ ├── unified_server.py # Main server
│ └── handlers/ # Request handlers
└── observability/ # Metrics and tracing
└── metrics/ # Modular metrics (by domain)

Running a Debate

from aragora import Arena, Environment, DebateProtocol

# Configure
env = Environment(task="Design a rate limiter")
protocol = DebateProtocol(rounds=3, consensus="majority")

# Select agents
agents = ["claude", "gpt4", "gemini"]

# Run
arena = Arena(env, agents, protocol)
result = await arena.run()

print(f"Consensus: {result.consensus_reached}")
print(f"Answer: {result.final_answer}")

Debate Phases

PhaseNameDescription
0Context InitInject history, patterns, research context
1ProposalsGenerate initial proposer responses
2Debate RoundsCritique/revision loop with convergence detection
3ConsensusVoting, weight calculation, winner determination
4-6AnalyticsMetrics, insights, verdict generation
7FeedbackELO updates, persona refinement, memory persistence

PostgreSQL Stores

All core stores have PostgreSQL implementations:

StoreClassTables
Consensus MemoryPostgresConsensusMemoryconsensus, dissent, verified_proofs
Critique StorePostgresCritiqueStoredebates, critiques, patterns, agent_reputation
Continuum MemoryPostgresContinuumMemorycontinuum_memory, tier_transitions
ELO RankingsPostgresEloDatabaseelo_ratings, tournaments, matches

Usage

from aragora.memory.postgres_consensus import get_postgres_consensus_memory
from aragora.ranking.postgres_database import get_postgres_elo_database

# Set DATABASE_URL environment variable
memory = await get_postgres_consensus_memory()
elo_db = await get_postgres_elo_database()

Memory Tiers

TierTTLPurpose
Fast1 minImmediate context
Medium1 hourSession memory
Slow1 dayCross-session learning
Glacial1 weekLong-term patterns

Key Environment Variables

VariablePurposeRequired
ANTHROPIC_API_KEYClaude APIOne API key required
OPENAI_API_KEYGPT APIOne API key required
DATABASE_URLPostgreSQL connectionFor production
OPENROUTER_API_KEYFallback providerRecommended

Adding a New Agent

from aragora.core import Agent, Message, Critique

class MyAgent(Agent):
name = "my_agent"

async def generate(self, prompt: str, context: list[Message] = None) -> str:
# Call your LLM
return response

async def critique(self, proposal: str, task: str, context: list[Message] = None) -> Critique:
# Generate critique
return Critique(
agent=self.name,
target_agent=target,
issues=["Issue 1"],
suggestions=["Suggestion 1"],
severity=0.5,
)

Running Tests

# Full test suite
pytest tests/ -v

# Specific module
pytest tests/debate/ -v

# Integration tests (requires DATABASE_URL)
DATABASE_URL=postgresql://... pytest tests/integration/ -v

# Quick syntax check
python -c "import aragora"

Common Commands

# Start server
python -m aragora.server.unified_server --port 8080

# Run nomic loop
python scripts/run_nomic_with_stream.py run --cycles 3

# Check codebase health
python scripts/verify_system_health.py

Key Documentation

DocumentPurpose
ARCHITECTURE.mdSystem architecture overview
API_REFERENCE.mdREST API documentation
POSTGRESQL_MIGRATION.mdPostgreSQL setup guide
AGENT_DEVELOPMENT.mdCreating custom agents
RLM_GUIDE.mdRecursive Language Model usage
MEMORY_TIERS.mdMemory system design

Metrics

Metrics are organized by domain in aragora/observability/metrics/:

  • core.py - Debate and request metrics
  • stores.py - Storage operation metrics
  • bridge.py - Knowledge bridge metrics
  • security.py - Auth and security metrics
  • gauntlet.py - Gauntlet run metrics

Getting Help

  • Check CLAUDE.md in the repo root for AI assistant context
  • See docs/STATUS.md for feature implementation status
  • Review docs/ADR/README.md for architectural decisions