Agent Templates & Factory
Pre-configured agent templates (data-science, marketing, support) plus a dynamic Agent Factory that routes user intent to the best registered agent.
Pre-configured Templates — import ready-made templates (dataScienceTemplate, marketingTemplate, supportTemplate) and use them directly with ChatInterface, or build your own with createCustomTemplate.
Agent Factory (Dynamic Routing) — register agents with descriptions, templates, and matching patterns in an AgentRegistry, then use IntentAnalyzer to classify a user message and route it to the best-fitting agent.
Examples
Pre-configured Templates
import { dataScienceTemplate, marketingTemplate, supportTemplate, createCustomTemplate } from 'flowstack-sdk';
// Use with ChatInterface
<ChatInterface template="data-science" />
<ChatInterface template="marketing" />
<ChatInterface template="support" />
// Custom template
const custom = createCustomTemplate({
streaming: true,
networkMode: 'PUBLIC',
systemPrompt: 'You are a helpful assistant for ...',
});Agent Factory (Dynamic Routing)
import { AgentFactory, IntentAnalyzer, AgentRegistry, DEFAULT_PATTERNS } from 'flowstack-sdk';
// Register agents
const registry = new AgentRegistry();
registry.register({
name: 'data-analyst',
description: 'Analyzes datasets and creates visualizations',
template: dataScienceTemplate,
patterns: [/analyz/i, /chart/i, /data/i],
});
// Analyze user intent and route to best agent
const analyzer = new IntentAnalyzer({ registry });
const intent = analyzer.analyze('Show me a chart of Q4 revenue');
// → { category: 'data-analysis', confidence: 0.92, entities: ['Q4 revenue'] }NoteTwo agent layers — which to use. This Factory/Templates layer is client-side: templates are
ChatInterface presets and AgentFactory/IntentAnalyzer/AgentRegistry route a user message to a template in the browser. The backend persona system (casino_create_agent + the persona option on useAgent) is what actually scopes tools/capabilities and is enforced server-side. For built apps, prefer backend personas (persona) for anything touching data or tools; use client-side Factory routing only to pick a chat style/template among personas you've already registered. They compose: route with the Factory, then pass the chosen persona name to useAgent({ persona }).See also
useAgent · ChatInterface · agent-catalog
Source: README.md#agent-templates--factory · Also available in llms-full.txt and registry.json.