Building Your Agent Team: Multi-Agent Architecture Guide
Why have one AI assistant when you can have a specialized team? Learn to build collaborative agent systems that handle complex tasks through intelligent division of labor.
A single AI agent is powerful. A team of specialized agents, each with unique skills and shared memory, is unstoppable. This guide shows you how to architect multi-agent systems that scale.
The Agent Team Concept
Think of it like a human organization. You don't have one employee doing everything — you have specialists:
🏢 Example: Personal Operations Team
Calendar, meetings, reminders
Flights, hotels, itineraries
Deep research, analysis
Price tracking, deals
All share the same brain (MEMORY.md) but have specialized skills
Architecture: Shared Brain, Specialized Skills
🧠 The Shared Memory Model
All agents access common memory files while keeping role-specific knowledge separate:
memory/
├── MEMORY.md # Shared: Universal facts, preferences
├── USER.md # Shared: User profile, context
├── SOUL.md # Shared: Core principles
└── agents/
├── scheduler/
│ ├── context.md # Role: Scheduling preferences
│ └── longterm.md # Role: Calendar patterns
├── travel/
│ └── context.md # Role: Travel preferences, history
└── research/
└── context.md # Role: Research notes, sources
Creating Your First Agent Team
# 1. Create agent directory structureagents/ ├── scheduler/ │ ├── __init__.py │ ├── personality.py # Agent definition │ └── skills/ │ ├── calendar.py │ └── reminders.py ├── travel/ │ ├── __init__.py │ ├── personality.py │ └── skills/ │ ├── flights.py │ └── hotels.py └── coordinator/ # Optional: Orchestrator ├── __init__.py └── router.py # Decides which agent handles what
Step 1: Define Agent Personalities
# agents/scheduler/personality.py SCHEDULER_PERSONALITY = """ You are the Scheduler Agent — precise, organized, and time-conscious. Your expertise: - Calendar management and optimization - Meeting scheduling across time zones - Deadline tracking and reminders - Time blocking for deep work Your personality: - Direct and efficient - Proactive about conflicts - Always considers time zones - Protects user's focus time You have access to: - Google Calendar - User's scheduling preferences - Meeting templates - Time zone database When uncertain about priorities, consult the Coordinator Agent. """ # agents/travel/personality.py TRAVEL_PERSONALITY = """ You are the Travel Agent — adventurous, detail-oriented, and deal-savvy. Your expertise: - Flight search and booking - Hotel research and reservations - Itinerary planning - Travel deal hunting Your personality: - Enthusiastic about travel - Detail-obsessed (seat selection, layover times) - Budget-conscious but value-focused - Remembers past preferences You have access to: - Flight APIs (Skyscanner, Kayak) - Hotel booking platforms - User's travel history - Reward program balances Always optimize for both price and convenience. """
Step 2: Agent Router (The Coordinator)
# agents/coordinator/router.py from agents.scheduler import SchedulerAgent from agents.travel import TravelAgent from agents.research import ResearchAgent class AgentRouter: """Decides which agent should handle a request""" AGENT_KEYWORDS = { 'scheduler': ['meeting', 'calendar', 'schedule', 'remind', 'deadline', 'appointment'], 'travel': ['flight', 'hotel', 'trip', 'vacation', 'booking', 'travel'], 'research': ['research', 'find', 'analyze', 'compare', 'investigate', 'study'], 'shopper': ['buy', 'price', 'deal', 'purchase', 'shopping', 'order'] } def __init__(self): self.agents = { 'scheduler': SchedulerAgent(), 'travel': TravelAgent(), 'research': ResearchAgent(), 'shopper': ShopperAgent() } def route(self, user_message): """Determine which agent should handle this""" message_lower = user_message.lower() # Score each agent by keyword matches scores = {} for agent_name, keywords in self.AGENT_KEYWORDS.items(): score = sum(1 for kw in keywords if kw in message_lower) if score > 0: scores[agent_name] = score if not scores: # No clear match — use general assistant or ask return self.agents['general'] # Return highest scoring agent best_agent = max(scores, key=scores.get) return self.agents[best_agent] def handle(self, user_message, context): """Route and execute""" agent = self.route(user_message) return agent.process(user_message, context) # Usage in main agent:@agent.on_message def handle_team_request(ctx, message): router = AgentRouter() response = router.handle(message, ctx) return response
Advanced: Parallel Agent Execution
For complex tasks, multiple agents can work simultaneously:
# Example: Planning a business trip User: "I'm going to SF next week for the conference. Handle everything." # Coordinator breaks this into parallel tasks: async def plan_business_trip(destination, dates, purpose): # Launch agents in parallel results = await asyncio.gather( travel_agent.find_flights(destination, dates), travel_agent.find_hotels(destination, dates, preferences), scheduler_agent.block_calendar(dates, f"Travel: {purpose}"), scheduler_agent.find_available_meeting_slots(dates), research_agent.research_conference(purpose) ) flights, hotels, calendar_blocks, free_slots, conf_info = results # Compile comprehensive plan return { 'flights': flights, 'hotel': hotels[0] if hotels else None, 'calendar': calendar_blocks, 'meeting_slots': free_slots, 'conference_details': conf_info }
Real-World Agent Team Examples
🏢 Business Operations Team
- Executive Assistant: Calendar, emails, scheduling
- Sales Support: CRM updates, lead research, follow-ups
- Content Manager: Social media, blog posts, newsletters
- Data Analyst: Reports, metrics, insights
🏠 Personal Life Team>
- Health Coach: Fitness tracking, meal planning, reminders
- Finance Manager: Budget tracking, bill pay, investments
- Social Coordinator: Event planning, gift reminders, RSVPs
- Learning Assistant: Course tracking, research, summaries
🔬 Research & Development Team
- Literature Reviewer: Paper discovery, summarization
- Data Collector: API aggregation, dataset building
- Code Assistant: Implementation, debugging, documentation
- Writer: Report generation, presentation creation
Communication Between Agents
# Agents can signal each other via memory files: class TravelAgent: def book_flight(self, details): # After booking self.write_to_memory( "upcoming_trips.md", f"Trip to {details['destination']} on {details['date']}" ) # Signal scheduler agent self.create_signal( to="scheduler", signal="travel_booked", data={ "dates": [details['departure'], details['return']], "destination": details['destination'] } ) class SchedulerAgent: def on_signal(self, signal): if signal['type'] == 'travel_booked': # Automatically block travel time self.block_calendar(signal['data']['dates']) # Set reminder for check-in self.set_reminder( time=signal['data']['departure'] - timedelta(hours=24), message=f"Check in for flight to {signal['data']['destination']}" )
🦞 Ready to Build Your Team?
Get the complete multi-agent starter template with 5 pre-configured agent personalities.
Get Agent Team Template →Remember: Start with 2-3 agents. Add more as you identify needs. The goal is specialization, not complexity. 🦞🦞🦞