Skip to content

Latest commit

 

History

History
64 lines (55 loc) · 7.05 KB

ARCHITECTURE.md

File metadata and controls

64 lines (55 loc) · 7.05 KB

Architecture

Part of the AgentSwarms docs.

See also Scale and limits for where each module's work executes (warehouse pushdown vs. local DuckDB) and every row, timeout and concurrency cap.

This page is the map. The engineering behind AgentSwarms is the territory: how a request acquires an identity, how the agent and swarm runtimes actually execute, the three sandboxes and the threat model each answers, and the conventions that keep all of it from drifting.

Tech stack

Layer Tech
Framework TanStack Start (React 19), file-based routing via TanStack Router
Backend Supabase — Postgres, Auth, Storage, pgvector
Styling Tailwind CSS + shadcn/ui
Agents LangChain / LangGraph
Swarm canvas XYFlow
BI & SQL Custom SVG chart renderers · in-browser SQL via DuckDB-WASM · server-side local SQL on DuckDB, with AlaSQL as an opt-out escape hatch there (LOCAL_ENGINE=alasql; the browser has no such fallback). The two DuckDBs are one minor line (1.5); tests/unit/duckdbEnginesParity.test.ts runs both and fails when they part
Documents Client-side pptxgenjs · docx · write-excel-file
Notebooks Python on sandboxed server kernels (Docker or Kubernetes) — see DEVELOPER_WORKSPACE_RUNTIME.md
Custom code Function / component nodes: a browser Worker on the canvas, and an isolated container for deployed runs — see DEPLOYMENT.md § JS sandbox
Deployment Docker (Node) · Kubernetes · installable PWA

Project structure

agentswarms/
├── src/
│   ├── routes/       # pages and API routes (file-based routing)
│   ├── components/   # UI, organized by feature (agents, swarms, playground, bi, ...)
│   ├── lib/          # agent/swarm export, BI/charts, docGen, sample data
│   └── utils/        # server-side utilities (providers, tools, warehouse, catalog, iam, observability)
└── supabase/
    └── migrations/   # the full database schema, as SQL migrations

Extension seams worth knowing:

  • Warehouse connectors — src/utils/warehouse/drivers.server.ts exposes executeWarehouseQuery / listWarehouseTables / testWarehouseConnection, switching on config.provider. Everything downstream (Data Catalog, BI Direct Query, semantic executor, SQL agents) goes through these, so adding a database means adding one driver + a WarehouseProvider union member + a zod ConfigSchema entry. See Data sources & connectors.
  • Charts — ChartSpec + the renderers under src/components/bi/ drive every visual type.
  • ETL pipelines — src/utils/etl/codegen.ts compiles the visual step graph to Python; a new step kind is one union member + one stepLine case + a line in the builder palette. Execution rides the notebook runtime unchanged. See ETL pipelines.
  • Document generation — src/lib/docGen/ (typed plans → client-side builders). See Agent Chat & document generation.
  • Custom code — user-authored JavaScript (Function nodes, custom components) runs in one of two sandboxes with a shared contract: src/lib/sandbox/jsSandbox.ts (a browser Worker, used by the canvas) and services/js-sandbox/ (a separate hardened container, used by deployed and scheduled runs). Neither ever executes in the app process, which holds the service-role key. tests/unit/sandboxParity.test.ts pins the two to the same contract so a component behaves identically wherever it runs.