Advanced Sub-Agents
Build sophisticated multi-agent workflows with complex coordination patterns and specialized capabilities.
Build sophisticated multi-agent workflows with complex coordination patterns and specialized capabilities.
Quick Start
Clone the Complete Example
The easiest way to get started is to clone the complete example repository:
git clone https://github.com/astreus-ai/examples
cd examples/sub-agents-advanced
npm installOr Install Package Only
If you prefer to build from scratch:
npm install @astreus-ai/astreusEnvironment Setup
# .env
OPENAI_API_KEY=sk-your-openai-api-key-here
ANTHROPIC_API_KEY=your-anthropic-api-key-here
DB_URL=sqlite://./astreus.dbMulti-Model Agent Team
import { Agent } from '@astreus-ai/astreus';
// Create diverse agent team with different models
const strategicPlanner = await Agent.create({
name: 'StrategicPlanner',
model: 'gpt-4o', // High reasoning for strategy
systemPrompt: 'You are a strategic business consultant with deep analytical thinking.',
memory: true,
knowledge: true
});
const creativeWriter = await Agent.create({
name: 'CreativeWriter',
model: 'claude-3-5-sonnet-20241022', // Excellent for creative writing
systemPrompt: 'You are a creative copywriter who crafts compelling narratives.',
vision: true
});
const dataScientist = await Agent.create({
name: 'DataScientist',
model: 'gpt-4o', // Strong analytical capabilities
systemPrompt: 'You are a data scientist specializing in statistical analysis and insights.',
useTools: true
});
const executiveTeam = await Agent.create({
name: 'ExecutiveTeam',
model: 'gpt-4o', // High-level coordination
systemPrompt: 'You coordinate executive-level strategic initiatives across expert teams.',
subAgents: [strategicPlanner, creativeWriter, dataScientist]
});
const businessPlan = await executiveTeam.ask(
'Develop comprehensive go-to-market strategy for AI-powered healthcare platform',
{
useSubAgents: true,
delegation: 'auto',
coordination: 'sequential'
}
);
console.log('Business plan completed:', businessPlan);Running the Example
If you cloned the repository:
npm run devIf you built from scratch, create an index.ts file with the code above and run:
npx tsx index.tsRepository
The complete example is available on GitHub: examples/sub-agents-advanced
Last updated: June 7, 2026
In this section
Your First Agent
Create your first AI agent with Astreus framework. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.
Agent with Memory
Build agents with persistent memory capabilities. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.
Agent with Knowledge
Create agents with knowledge base capabilities for enhanced information retrieval. Learn the setup patterns, APIs, and practical examples needed to build...
Agent with Vision
Create agents capable of processing and analyzing images. Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.