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:
1
Access Teams View
Click on the “Agent Teams” tab in the navigation bar to view your existing teams or create a new one.
2
Create New Team
Click the “Create AI Agents Team” button to start building your team.
3
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
4
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
5
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.
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
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.
There are two main approaches to executing multi-agent teams:
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.
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.
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:
from xpander_sdk import XpanderClient, LLMProviderimport os# Initialize clientsxpander_client = XpanderClient(api_key=os.environ["XPANDER_API_KEY"])# Load your sequence agentsfirst_agent = xpander_client.agents.get(agent_id="first-agent-id")next_agent = xpander_client.agents.get(agent_id="next-agent-id")# Initialize and run your first agent - this automatically initializes memoryfirst_agent.add_task(input="Initial task description")# Process with first agent until you decide to transition# (You can use your own logic to determine when to transition)# ...execution loop for first agent...# IMPORTANT: Force transition regardless of first agent's completion status# Note that we don't check is_finished() - we explicitly move to the next agentresult = first_agent.retrieve_execution_result()transition_context = result.result if result.status == "COMPLETED" else "Continue processing"# Store the thread_id for potential continuityfirst_agent_thread_id = result.memory_thread_id# Initialize next agent with context from first agent - this automatically initializes memory# Option 1: Start a new threadnext_agent.add_task(input=f"Continue processing: {transition_context}")# Optional: Transfer relevant memory contextfor msg in first_agent.messages[-5:]: # Last 5 messages for context if msg["role"] != "system": # Skip system messages next_agent.add_messages(msg)# Option 2 (Alternative): Continue in the same thread for context continuity# next_agent.add_task(# input=f"Continue processing: {transition_context}",# thread_id=first_agent_thread_id# )
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.