Skip to main content
Location: examples/market-macro-agent/ A real-time financial data pipeline agent powered by Datris. MacroAgent acts as a pipeline orchestrator: it connects to the Datris MCP server, provisions four platform-owned taps (FRED, equities, crypto, SEC filings), triggers them to refresh data, and answers market questions grounded in actual numbers. The Datris platform does the fetching; the agent decides when and what to refresh. Everything runs in the browser with a live activity feed. 100% Python — FastAPI backend, vanilla JS frontend, no Node.js required.

Architecture

How It Works

  1. On startup — Connects to the Datris MCP server via SSE, discovers tools via tools/list, loads the server’s instructions and resources, pushes FRED_API_KEY from .env into Datris as a tap secret (create_tap_secret), and provisions four taps (fred_tap, equities_tap, crypto_tap, sec_tap), each wired to its own pipeline. Idempotent: re-running against an existing install is a no-op. Taps are created with scheduling disabled so the agent’s own loop drives refreshes.
  2. User asks a question — MacroAgent determines which data family is relevant
  3. Refresh — The agent calls run_tap. The platform runs the tap’s Python fetch() in a Docker sandbox and submits records into the pipeline
  4. Wait for ingestion — Ingestion is asynchronous; the agent polls get_pipeline_status with the run’s publisherToken until every row’s state is end or error
  5. Query — The agent queries the landed data via query_postgres and answers grounded in actual numbers
  6. Background refresh — Every REFRESH_INTERVAL_MINUTES the scheduler calls run_tap for every pipeline that has been exercised at least once
  7. Tap health — Ask about failures and the agent calls get_tap_logs to report the last runs and any errors

Data Sources

Quick Start

Open http://localhost:8001

Demo Queries

  • "What's the current macro picture?" — runs the FRED + equities taps, then queries
  • "Refresh all taps" — triggers run_tap across all four data families
  • "Is crypto confirming the risk-on trade in equities?" — cross-pipeline analysis
  • "Show me the last few tap runs" — exercises get_tap_logs live

Environment Variables

Requirements