Prometheus AI Overview
Prometheus is Nester's AI intelligence service, built with Python + FastAPI and powered by the Claude API.
Service Architecture
python
# apps/intelligence/app/main.py
from fastapi import FastAPI
from contextlib import asynccontextmanager
@asynccontextmanager
async def lifespan(app: FastAPI):
# Startup: initialize Claude client, load market data
app.state.claude = anthropic.Anthropic()
app.state.market_data = MarketDataService()
yield
# Shutdown: cleanup
app = FastAPI(title="Prometheus", lifespan=lifespan)
app.include_router(chat_router, prefix="/intelligence")
app.include_router(insights_router, prefix="/intelligence")
app.include_router(risk_router, prefix="/intelligence")System Prompt Strategy
python
def build_system_prompt(portfolio: dict, market: dict) -> str:
return f"""You are Prometheus, Nester's AI financial advisor.
Current portfolio:
{json.dumps(portfolio, indent=2)}
Market conditions:
{json.dumps(market, indent=2)}
Rules:
1. Never recommend executing trades without user approval
2. Always explain your reasoning in plain language
3. Provide confidence levels (0-100%) for recommendations
4. Consider the user's risk tolerance and time horizon
5. Flag any risks or concerns clearly
6. Use specific numbers from the portfolio data
"""Data Sources
| Source | Data | Update Frequency |
|---|---|---|
| DeFiLlama | Protocol TVL, yield rates | Every 5 minutes |
| CoinGecko | Token prices, market caps | Every 1 minute |
| Stellar Horizon | On-chain tx data, balances | Real-time |
| Social APIs | Sentiment from Twitter/Reddit | Every 15 minutes |