Multi-agent AI systems represent one of the most significant advances in practical AI applications today.

Unlike traditional single-agent approaches, multi-agent systems distribute complex tasks across specialized agents, each handling what they do best.

In this article, we'll explore a practical example that uses specialized agents with access to Gmail and Slack tools. This involves the integration of two frameworks. The OpenAI Agents SDK will run and orchestrate the agents, and Arcade will handle the tools and authentication required to use them.

You'll understand the core concepts behind agent handoffs, human-in-the-loop controls, and the technical foundations needed to build your own multi-agent applications.

Understanding Multi-Agent Architecture

A multi-agent system consists of specialized AI agents designed to handle specific tasks while collaborating through a structured communication framework.
This architecture offers several advantages over single-agent approaches:

  • Separation of concerns: A single agent is likely to be OK at most things, but not great at anything in particular. By splitting the taks into narrower domains, we can assign expert agents to each relevant task, increasing the accuracy and performance of each of the tasks.
  • Cost optimization: The latests LLMs are very impressive in their reasoning capabilities, but also very expensive to run. A multi-agent system allows us to mix and match each task to an agent using smaller models for their specific tasks.
  • Composability and adaptability: Multi-agent systems are easy to adapt to dynamic situations. Adding and removing agents is easy and doesn't involve retraining or re-optimizing a single agent.
  • Parallel processing: A single agent will generally run sequentially, focusing on one task at a time. A multi-agent system can natively perform multiple tasks in parallel, providing results faster and improving UX.
  • Robustness: If your single-agent system can't solve a specific issue, that's the end of it. Conversely, multi-agent systems may approach the problem using multiple approaches, providing a higher likelihood of success.
  • Complex Problem Solving: Multi-agent systems natively integrate the strengths of various agents to tackle complex problems more effectively than a single agent. This is especially relevant for tasks that require a combination of skills, like multi-step data analysis and workflows.

Practical example

Our example app consists of 3 agents:

  • Conversational Agent: Handles user interaction and task delegation
  • Gmail Agent: Specializes in email operations (reading, composing, sending)
  • Slack Agent: Manages messaging platform interactions

This separation allows each agent to maintain focused instruction sets and specialized capabilities without creating an unwieldy "do-everything" system.

They are also fully connected, meaning any agent can pass control to any other agent, creating a flexible system capable of handling complex multi-step workflows.

Agent Definition and Connections

Tool calling agents need access to the tools they can call to solve their assigned tasks. We achieve this using Arcade's agents-arcade library, which handles auth and tool calling transparently:

google_tools = await get_arcade_tools(client, tools=["Google_ListEmails", "Google_SendEmail"])
slack_tools = await get_arcade_tools(client, tools=["Slack_ListUsers", "Slack_SendDmToUser"])

The key mechanism enabling multi-agent collaboration is the handoff - the ability for one agent to pass control to another when encountering a task outside its domain. We give each agent a name, instructions on what it's supposed to do. We also connect it to other agenst using the handoffs property, and we expose the capabilities to other agents using handoff_description.

# Declare a new agent
google_agent = Agent(
    name="Google Agent",
    instructions="You are a helpful assistant that can assist using tools"
                 " to manage a Google account, contacts, and inbox.",
    handoff_description="An agent equipped with Google tools",
    model=os.environ["OPENAI_MODEL"],
    tools=google_tools, # Provide access to relevant tools
    hooks=CustomAgentHooks(display_name="Google Agent")
)

slack_agent = Agent(
    name="Slack agent",
    instructions="You are a helpful assistant that can assist using tools"
                 " to interact with Slack."
                 " You have tools to manage channels and send DMs.",
    handoff_description="An agent equipped with Slack tools",
    model=os.environ["OPENAI_MODEL"],
    tools=slack_tools,
    hooks=CustomAgentHooks(display_name="Slack Agent"),
)

triage_agent = Agent(
    name="conversation_agent",
    instructions="You are a helpful assistant that can help with everyday"
                 " tasks. You can handoff to another agent with access to"
                 " Gmail tools if needed. You can also handoff to an agent"
                 " with Slack tools if needed. Handoff to the appropriate"
                 " agent based on the services required.",
    model=os.environ["OPENAI_MODEL"],
    handoffs=[google_agent, slack_agent], # connect it to other agents
    hooks=CustomAgentHooks(display_name="Conversation Agent")
)

# Buld remaining connections
google_agent.handoffs.extend([triage_agent, slack_agent])
slack_agent.handoffs.extend([triage_agent, google_agent])

The final topology looks like this, where arrows represent possible handoffs.

How to build AI Slack/Gmail Agent with OpenAI Agent SDK

Human-in-the-Loop Controls

One critical aspect of multi-agent systems, especially those handling sensitive operations like sending emails or messages, is implementing human-in-the-loop controls.

# Example of human approval implementation
async def confirm_tool_usage(context, tool_arguments, tool_name, callable):
    """Request human approval before executing sensitive operations"""
    print(f"About to call {tool_name} with these arguments:")
    print(json.dumps(json.loads(tool_arguments), indent=2))
    
    confirmation = input("Approve this action? (y/n): ")
    if confirmation.lower() == "y":
        return await callable(context, tool_arguments)
    else:
        raise UserDeniedToolCall(tool_name)

This approach ensures users maintain control over automated actions, preventing potentially unwanted operations while still benefiting from the system's capabilities.

Multi-Turn Operations with Gmail and Slack

A multi-agent system truly shines when handling complex, multi-turn operations across different services. Consider this example workflow:

  1. User asks: "Get my 5 most recent emails, summarize them, and send me the summaries on Slack"
  2. Conversational agent recognizes email and Slack components
  3. Handoff to Gmail agent to retrieve recent emails
  4. Gmail agent processes emails and extracts key information
  5. Handoff to Slack agent with the summarized content
  6. Human approval requested before sending the Slack message
  7. Message delivered after approval

This seemingly simple request involves multiple specialized agents working together, each handling their domain-specific tasks while maintaining the overall conversation context.

The Gmail agent component is particularly important, as it needs to handle various email operations like searching, reading, and composing messages. If you're interested in building a standalone Gmail agent before tackling a full multi-agent system, check out our guide: How to Build an AI Agent for Gmail: A Complete Guide for 2025.

Agent Auth: Solving the Multi-Service Authentication Challenge

Agent authentication represents one of the most significant hurdles when building multi-service systems. Each agent requiring access to external services like Gmail or Slack needs proper authentication credentials, creating several technical challenges:

  1. OAuth Complexity: Each service implements OAuth flows differently
  2. Token Management: Securely storing, refreshing, and managing access tokens
  3. User Experience: Creating seamless authentication experiences without disrupting workflows
  4. Cross-Service Identity: Maintaining consistent identity across multiple services

Using a platform like Arcade.dev can dramatically simplify agent auth implementation:

# Example of streamlined agent authentication
async def auth_tool(client, tool_name, user_id):
    """Authenticate an agent with external services"""
    result = await client.tools.auth.authorize(tool=tool_name, user_id=user_id)
    
    if result.status != "completed":
        print(f"Please complete authentication: {result.url}")

    await client.tools.auth.wait_for_completion(result)

This approach handles the complexity of maintaining authenticated sessions across multiple services, allowing developers to focus on agent functionality rather than authentication logistics. For enterprise applications requiring more sophisticated identity management, implementing SSO for agents can provide additional security and administrative controls.

Practical Applications of Multi-Agent Systems

The Gmail-Slack integration example demonstrates just one application of multi-agent systems. Other practical use cases include:

  1. Customer Service: Routing inquiries to specialized agents handling different aspects of customer support
  2. Research Assistance: Combining agents specialized in search, data analysis, and content generation
  3. Workflow Automation: Creating systems that handle multi-step business processes across various platforms
  4. Personal Productivity: Building assistants that coordinate tasks across email, calendars, and communication platforms

Building Your Own Multi-Agent System

If you're interested in implementing your own multi-agent system with the OpenAI Agents SDK, we've created a comprehensive video tutorial walking through the complete process of building the Gmail-Slack system described in this article.

The tutorial covers:

  • Setting up the OpenAI Agents SDK environment
  • Implementing agent handoffs
  • Building human-in-the-loop controls
  • Managing authentication across services
  • Debugging multi-agent interactions

Watch our full multi-agent systems tutorial on YouTube →

The Future of Multi-Agent Systems

As large language models continue to evolve, multi-agent architectures will become increasingly important for building practical, specialized AI systems. The ability to decompose complex tasks into specialized components that collaborate seamlessly represents a significant step toward more capable and trustworthy AI assistants.

By understanding the core concepts of agent handoffs, human-in-the-loop controls, and multi-turn operations, developers can create AI systems that transcend the limitations of single-agent approaches.

Sign up for an arcade.dev account to start building.→

Share this post