POWER: Multi-Agent Intelligence Swarm
An autonomous research analyst that detects anomalies in market data, correlates findings with news sentiment, builds a risk report, and routes it for human sign-off.
halo
// ============================================================
// POWER: Multi-Agent Intelligence Swarm
// ============================================================
// An autonomous research analyst that detects anomalies in
// market data, correlates findings with news sentiment,
// builds a risk report, and routes it for human sign-off.
// ============================================================
// --- SAFETY & COMPLIANCE ---
policy FinancialCompliance : Redact(PFI) & Block(InsiderTrading)
policy BudgetLimit : MaxSpend(25.00)
// --- TOOLS: External connections ---
tool Bloomberg : POST("api.bloomberg.com/v1/data", apiKey: Env.BLM_KEY)
tool NewsAPI : POST("api.newsapi.org/v2", apiKey: Env.NEWS_KEY)
tool SlackChannel : POST("hooks.slack.com/services/webhook-id")
tool VectorDB : PostgreSQL(Env.VECTOR_DB_URI)
// --- MEMORY: Persistent state ---
tool MarketHistory : VectorStore(Env.PINECONE_KEY, namespace: "market-data")
tool Playbook : VectorStore(Env.PINECONE_KEY, namespace: "response-playbooks")
// --- MINDS: The agents ---
// The researcher runs deep analysis with full tool access
@shadow(Researcher_QA)
agent Researcher [anthropic/claude-sonnet-4, temp: 0.1]
system """
You are a quantitative research analyst specializing in
market anomaly detection. Correlate price movements with
news events and historical patterns. Always include
confidence intervals and cite data sources.
"""
equips Bloomberg, MarketHistory, Playbook
requires FinancialCompliance, BudgetLimit
// The writer produces human-readable reports
agent ReportWriter [openai/gpt-4o-mini, temp: 0.3]
system """
You are a financial briefing author. Write concise
executive-level reports from raw analyst data. Structure
as: situation, analysis, recommendation, risk. Use
precise language — no hedging, no filler.
"""
requires FinancialCompliance
// The risk assessor makes go/no-go decisions
agent RiskAssessor [anthropic/claude-sonnet-4, temp: 0.0]
system """
You are a risk compliance officer. Make binary approve/reject
decisions on analyst reports. Check for regulatory exposure,
position-size risk, and compliance violations. Reject
anything with unresolved red flags.
"""
requires FinancialCompliance, BudgetLimit
// --- THE STREAM ---
@timeout(10m)
@retry(3, 5s)
pipeline AnomalyResponse(alert: Alert.MarketAnomaly) -> Report:
alert
// Step 1: Fan-out — run independent investigations in parallel
// Both tasks merge automatically when the block closes
|* {
Researcher.analyze(
context.data.alert.symbol,
"Compare current metrics against 90-day historical baseline"
) as assessment,
Researcher.search(
context.data.alert.symbol,
"breaking news about the affected company and sector"
) as news
}
// Step 2: Gate — only proceed if anomaly is confirmed (confidence > 75%)
|? (context.data.assessment.confidence > 75)
// Step 3: Correlate findings with existing playbooks
|> Researcher.similar(
context.data.assessment.summary,
0.85
) as playbook
// Step 4: Generate the report
|> ReportWriter.compose(
"AnalystBriefing",
[context.data.assessment, context.data.news, context.data.playbook],
"executive"
) as briefing
// Step 5: Risk sign-off — the assessor must approve
|> RiskAssessor.evaluate(
context.data.briefing,
"financial_compliance"
) as risk
// Step 6: Gate on risk decision
|? (context.data.risk.decision == "approve")
// Step 7: Send for final human review via Slack
|! yield(
SlackChannel,
context.data.briefing.executive_summary,
[context.data.briefing.full_report, context.data.briefing.charts],
1h
)
// Step 8: Wait for human response
~> listen(SlackChannel.Interaction) as human_response
// Step 9: Final gate — human approved?
|? (context.data.human_response.approved == true)
|> System.Distribute(
context.data.briefing.distribution_list,
SlackChannel
)