Multi-Agent Teams
Learn how to create and manage multi-agent teams in xpander.ai
Creating Multi-Agent Teams
xpander.ai allows you to create teams of specialized agents that work together to accomplish complex tasks.
For example, you can create a team of agents that work together to gather news from multiple sources, analyze the news, and then summarize the results.
Here’s how to set up a multi-agent team:
Access Teams View
Click on the “Agent Teams” tab in the navigation bar to view your existing teams or create a new one.
Create New Team
Click the “Create AI Agents Team” button to start building your team.
Add Agents
- Click the “Add Agent” button in your team workspace
- Select agents from the dropdown menu (e.g., HN Story Fetcher, LinkedIn AI Agent)
- Click “Done” to add the selected agents to your team
Configure Team Layout
By default, agents operate independently. To enforce sequential execution:
-
Click the “Builder” tab to access the visual canvas
-
Change the layout type from “Router” to “Sequence” in the Delegation settings
-
Draw connection lines between agents to define their execution order
Manager Layout
For more dynamic team coordination, use the Manager layout:
- Select “Manager” layout type in Delegation settings
- Configure the manager agent with high-level instructions
- The manager agent will:
- Analyze incoming tasks
- Determine optimal agent sequence
- Handle data passing between agents
- Monitor overall execution progress
This layout provides flexible, AI-driven orchestration where the manager agent intelligently decides how to coordinate the team and pass information between agents based on the task requirements.
Understanding Team Layouts
Understanding Team Layouts
xpander.ai supports two primary team layouts:
- Router Layout: Agents operate independently, with a router agent directing tasks to the most suitable agent
- Sequence Layout: Agents execute in a predefined order, with each agent’s output feeding into the next agent
The sequence layout is ideal when you need to:
- Ensure tasks are processed in a specific order
- Pass data through a series of specialized processing steps
- Create pipelines where each agent builds on the previous agent’s work
Memory Strategy
Memory Strategy
When configuring sequence layouts, you can choose how information is passed between agents:
- Summarized Memory Handoff: Passes a condensed version of relevant information
- Complete Memory Transfer: Transfers all context and memory to the next agent
- Initial Task Context Only: Only passes the original task description
Choose the strategy that balances comprehensive context with efficient processing.
After changing to sequence layout, you must draw connection lines between agents to define their execution order. Without these connections, the agents won’t know how to pass information between each other.
Executing Multi-Agent Teams Programmatically
You can execute multi-agent workflows programmatically using the xpander.ai SDK. The general pattern involves:
- Setting up the environment with necessary API keys
- Loading the agents that will participate in the workflow
- Executing the agent sequence with proper information passing between agents
Core Execution Pattern
The core execution pattern for multi-agent workflows follows these steps:
- Configure your environment with OpenAI and xpander.ai API keys
- Initialize both the xpander.ai and OpenAI clients
- Load your agent or agents from xpander.ai
- Create and initialize a task with appropriate context
- Execute a loop that:
- Generates LLM responses using the current agent’s tools
- Processes any tool calls made by the LLM
- Handles transitions between agents in sequence
Execution Approaches
There are two main approaches to executing multi-agent teams:
Simplified Approach
Simplified Approach
For most use cases, you can treat the entire agent team as a single entity. The xpander.ai SDK handles all the complexity of agent switching behind the scenes.
Key steps:
- Load the team’s manager agent
- Add a task to the manager agent
- Run the execution loop until completion
- The SDK automatically handles transitions between agents
This approach is ideal when you want the agent team to operate as a cohesive unit without needing to manage individual agents.
Direct Control Approach
Direct Control Approach
For more complex workflows, you can explicitly control each agent in the sequence:
Key steps:
- Load each agent in the team individually
- Define their execution order
- Execute each agent in sequence, passing results between them
- Manage the memory context transfer between agents
This approach gives you more control over the execution flow and allows for custom processing between agent steps.
Enforcing Agent Transitions Without Manager
Enforcing Agent Transitions Without Manager
For advanced use cases, you can enforce transitions between agents in a sequence even when the first agent believes it has completed its task - all without requiring a Manager Agent.
This powerful capability is particularly useful when:
- You need deterministic transitions at specific points in your workflow
- A first agent might incorrectly consider its task complete before all required steps are done
- You want to implement custom business logic for determining when to transition
- You need to split complex tasks across specialized agents with precise control
Here’s how to implement forced transitions:
This pattern gives you complete control over agent transitions without the overhead of a Manager Agent.
For most use cases, the simplified approach is recommended as it handles all the complexity of agent transitions automatically. Only use the direct control approach when you need to insert custom processing logic between agent steps.
Testing and Monitoring Multi-Agent Teams
Once your team is configured, you can test it through multiple interfaces provided by xpander.ai:
The chat interface provides a conversational way to interact with your team:
- Click the “Chat” button in the team workspace
- Enter your task or query
- Watch as agents collaborate to complete the task
- Review the final output and agent interactions
The chat interface provides a conversational way to interact with your team:
- Click the “Chat” button in the team workspace
- Enter your task or query
- Watch as agents collaborate to complete the task
- Review the final output and agent interactions