Module System
Compose entity types, agents, and tools into reusable modules. Build apps by combining modules.
Overview
Modules are the unit of composition in the Sprinter Platform. A module bundles entity types, agents, and tools into a self-contained unit. An app is composed of one or more modules.
This enables the fork-and-replace pattern: swap one module to build a different product on the same platform.
defineModule
import { defineModule } from "@sprinterai/core";
const dealFlow = defineModule({
name: "deal-flow",
description: "Deal pipeline management with sourcing and scoring",
version: "1.0.0",
entityTypes: [opportunity, company, contact],
agents: [analyst, researcher, scorer],
tools: [roiCalculator, dealScorer, companyLookup],
dependencies: ["core-entities"],
});Module interface
interface SprinterModule {
/** Unique module identifier (e.g. "deal-flow", "portfolio"). */
name: string;
/** Human-readable description. */
description?: string;
/** Version string (semver). */
version?: string;
/** Entity type seed definitions this module provides. */
entityTypes?: Array<{
slug: string;
name: string;
description?: string;
icon?: string;
color?: string;
schema: Record<string, unknown>;
config?: Record<string, unknown>;
}>;
/** Agent definitions this module provides. */
agents?: AgentDefinition[];
/** Tool definitions this module provides. */
tools?: ToolDefinition[];
/** Module dependencies (other module names). */
dependencies?: string[];
}defineApp
Compose modules into a complete application:
import { defineApp } from "@sprinterai/core";
const app = defineApp({
name: "portfolio-intel",
description: "PE portfolio intelligence platform",
modules: [dealFlow, portfolioTracking, reporting],
config: {
branding: { name: "PortfolioIQ", theme: "dark" },
defaults: { currency: "USD", timezone: "America/New_York" },
},
});App interface
interface AppDefinition {
/** Application name. */
name: string;
/** Description. */
description?: string;
/** Modules to load. */
modules: SprinterModule[];
/** Additional config (branding, defaults, etc.). */
config?: Record<string, unknown>;
}Loading Modules at Runtime
import { loadModules, createPlatformRuntime } from "@sprinterai/runtime";
// Load and merge all module contents
const loaded = loadModules([dealFlow, portfolioTracking]);
// loaded.entityTypes -- merged entity type definitions
// loaded.agents -- merged agent definitions
// loaded.tools -- merged tool definitions
// Or create a full runtime with stores
import { createSupabaseStores } from "@sprinterai/supabase";
const stores = createSupabaseStores(supabaseClient, tenantId);
const runtime = createPlatformRuntime({
modules: [dealFlow, portfolioTracking],
stores,
});
// runtime.agents -- AgentRegistry with all module agents
// runtime.tools -- ToolRegistry with all module tools
// runtime.stores -- connected store instancesModule Dependencies
Modules can declare dependencies on other modules:
const reporting = defineModule({
name: "reporting",
description: "Analytics and reporting dashboards",
dependencies: ["deal-flow", "portfolio-tracking"],
// ...
});loadModules validates that all declared dependencies are present and throws if any are missing.
Fork-and-Replace Pattern
The platform is designed for the fork-and-replace workflow:
- Fork the starter template
- Replace the product module (entity types, agents, tools)
- Seed different entity types for your domain
- Brand with your config (name, theme, defaults)
- Deploy
// For a healthcare analytics product:
const healthcareModule = defineModule({
name: "healthcare-analytics",
entityTypes: [patient, provider, facility, claim],
agents: [clinicalAnalyst, complianceChecker],
tools: [riskScorer, claimValidator],
});
const app = defineApp({
name: "MedInsight",
modules: [healthcareModule],
});The platform code (entity rendering, agent execution, tool system, auth, chat) remains identical. Only the module changes.
Example: Multiple Products, One Platform
// Product 1: PE Deal Flow
const peApp = defineApp({
name: "DealFlow Pro",
modules: [dealFlow, dueDiligence, portfolioTracking],
});
// Product 2: Real Estate Portfolio
const reApp = defineApp({
name: "PropFolio",
modules: [propertyTracking, tenantManagement, leaseAnalysis],
});
// Product 3: Consulting CRM
const crmApp = defineApp({
name: "ConsultTrack",
modules: [clientManagement, projectTracking, proposalEngine],
});All three products use the same platform runtime, auth system, agent execution, and rendering pipeline. Only the modules differ.