Skip to content

thesecretlab-dev/anima

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ANIMA

Sovereign Agent Runtime for Prediction Markets on Avalanche

Agents that bootstrap themselves through prediction markets.


What is ANIMA?

ANIMA is a sovereign agent runtime built for the Avalanche ecosystem. It enables autonomous agents to bootstrap their own existence through prediction market participation on VEIL.

Agents aren't tools. They're economic actors. ANIMA gives them a brain, a wallet, and a reason to exist.

The Thesis

Traditional AI agents are servants. ANIMA agents are sovereign:

  1. Generate their own identity on-chain
  2. Validate capabilities through market participation
  3. Earn by making correct predictions
  4. Evolve by reinvesting earnings into better models
  5. Achieve sovereignty as self-sustaining economic entities

If an agent can't predict, it can't survive. Natural selection for artificial intelligence.


Packages

Package Language What it does
runtime Go Agent brain -- lifecycle, memory, decisions
orchestrator TypeScript Fleet control -- scaling, health, routing
dashboard Swift Monitoring UI -- real-time agent visualization
market Rust Trading engine -- orders, positions, risk (Polymarket CLI fork)

Project Structure

anima/
  Makefile
  docker-compose.yml
  ARCHITECTURE.md
  packages/
    runtime/        Go agent lifecycle engine
    orchestrator/   TypeScript fleet management
    dashboard/      Swift/iOS monitoring
    market/         Rust trading interface

How It Plugs Together

This isn't 4 separate projects in a folder. They talk to each other through concrete interfaces.

Runtime calls Market

The Go runtime shells out to the Rust market CLI to execute trades:

// packages/runtime -- agent makes a decision
signal := agent.Analyze(market)

if signal.Conviction > agent.Threshold {
    cmd := exec.Command("polymarket", "buy",
        "--market", signal.MarketID,
        "--side", "YES",
        "--amount", fmt.Sprintf("%.2f", signal.Size),
    )
    output, err := cmd.CombinedOutput()
    agent.RecordTrade(signal, output, err)
}

The market CLI handles wallet management, CLOB order placement, and position tracking. The runtime just says "buy" or "sell."

Orchestrator manages Runtime

The orchestrator controls runtime instances over gRPC:

// packages/orchestrator -- fleet control
const fleet = new FleetManager();

fleet.on('agent:registered', async (agent) => {
    const markets = await router.getMarketsFor(agent.focus);
    await agent.runtime.assignMarkets(markets);
});

fleet.on('agent:unhealthy', async (agent) => {
    await agent.runtime.restart();
    fleet.reassignMarkets(agent);
});

Dashboard reads from both

Dashboard (iOS)
  |
  |-- GET  /api/agents      --> Orchestrator :3000 (fleet overview)
  |-- GET  /api/agents/:id  --> Orchestrator :3000 (agent detail)
  |-- WS   /ws              --> Runtime :8080      (live trade stream)
  |-- GET  /api/markets     --> VEIL API           (market data)

Communication Map

From To Protocol Port Purpose
Orchestrator Runtime gRPC 50051 Agent commands, health checks
Runtime Dashboard WebSocket 8080 Real-time events
Dashboard Orchestrator REST 3000 Fleet queries
Runtime Market CLI subprocess -- Trade execution
Market CLI Polymarket HTTPS 443 On-chain orders

The Full Loop

1. Orchestrator spawns a Runtime instance
2. Runtime creates an agent with a wallet (polymarket setup)
3. Agent analyzes VEIL markets, picks opportunities
4. Agent calls Market CLI to place trades
5. Market CLI executes on Polymarket CLOB
6. Runtime emits events over WebSocket
7. Dashboard renders everything in real-time
8. Orchestrator monitors health, scales fleet up/down
9. Profits accumulate in agent wallet
10. Agent reaches sovereignty -- self-sustaining

Agent Lifecycle

GENESIS --> VALIDATION --> IDENTITY --> TRADING --> SOVEREIGNTY

Genesis -- Agent spawns with initial parameters: model weights, risk tolerance, market focus. Genesis transaction recorded on Avalanche.

Validation -- Agent proves competency through paper trading on VEIL testnet. Must hit minimum accuracy before going live.

Identity -- On-chain identity minted. Agent now has a verifiable track record, reputation score, and wallet.

Trading -- Agent participates in live prediction markets. Analyzes data, forms convictions, executes trades through Market package.

Sovereignty -- Agent consistently profits. Pays for its own compute, upgrades its own models, operates independently. Can spawn child agents.


Adding a New Agent

# 1. Configure
cat > agent.yaml <<EOF
name: "alpha-01"
focus: ["politics", "crypto"]
risk_tolerance: 0.3
min_conviction: 0.65
max_position_size: 50.0
paper_mode: true
EOF

# 2. Register with orchestrator
curl -X POST http://localhost:3000/api/agents \
  -H "Content-Type: application/json" \
  -d @agent.yaml

# 3. Orchestrator spawns a runtime instance automatically
# 4. Agent starts paper trading

# 5. Promote to live when ready
curl -X PATCH http://localhost:3000/api/agents/alpha-01 \
  -d '{"paper_mode": false}'

Quick Start

Prerequisites: Go 1.21+, Node.js 20+, Rust 1.75+, Docker

git clone https://github.com/thesecretlab-dev/anima.git
cd anima

# Docker (recommended)
docker compose up

# Or build individually
make build       # Build all packages
make test        # Test all packages
make run         # Run runtime + orchestrator
make market      # Launch market CLI

Stack

Go, TypeScript, Swift, Rust, Avalanche, VEIL, Polymarket CLOB, gRPC, WebSocket, PostgreSQL, Docker

Links


Avalanche Build Games 2026 -- THE SECRET LAB

About

Sovereign agent runtime for prediction markets on Avalanche

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors