Multi-Agent

Multi-agent is a pattern for building more capable apps. Instead of one general-purpose agent, you build a team of specialists, each owning one domain of your app, and let them coordinate. All agents run on device, in the same process, with access to the same Apple APIs.

The Mental Model

Think of each agent as a department head in your app. Your calendar agent knows EventKit deeply. Your health agent knows HealthKit. Your notes agent knows your document schema. A coordinator routes the user's natural language request to whoever is best equipped to handle it.

This mirrors how you already structure large Apple platform apps: services own specific data sources, view controllers own specific domains. Multi-agent applies the same separation of concerns to AI reasoning.

User: "What should I focus on today?" coordinator
calendar agent (reads EventKit)
health agent (reads HealthKit)
tasks agent (reads Reminders)
→ synthesize → Final answer

Coordination Models

There are three ways to coordinate agents. Choose based on whether you know the steps ahead of time, whether routing depends on user intent, or whether any agents live off-device:

Choosing a Coordination Model

SituationUse
You want to analyze the same data multiple ways simultaneously (HealthKit summary, meeting transcript, photo library)Graph
You're building a natural language assistant that covers multiple domains (calendar, notes, tasks)Swarm
A task is too compute-heavy for on-device, or needs a model only your backend runsA2A
Your backend team uses Python or TypeScript Strands and you want to call their agent from your appA2A

Agents as Tools

All three models share the same underlying primitive: an agent can call another agent as a tool. The outer agent invokes the inner agent exactly like any other tool call, with no knowledge of what the inner agent does internally.

This is how you build an assistant that spans multiple Apple frameworks without creating one agent that knows everything:

Daily briefing assistantSwift
// Each specialist owns one Apple framework
let calendarAgent = Agent(
    model: provider,
    tools: [readCalendarEvents, checkAvailability],
    systemPrompt: "Read today's EventKit calendar and summarize the schedule and any conflicts."
)

let healthAgent = Agent(
    model: provider,
    tools: [readSleepData, readActivityRings, readHeartRate],
    systemPrompt: "Read today's HealthKit data and summarize sleep quality, activity, and anything worth noting."
)

let tasksAgent = Agent(
    model: provider,
    tools: [listReminders, listIncompleteItems],
    systemPrompt: "Read the Reminders store and summarize overdue and high-priority tasks."
)

// Wrap each specialist as a tool
let calendarTool = AgentTool(name: "check_calendar", description: "Get today's schedule from Calendar",  agent: calendarAgent)
let healthTool   = AgentTool(name: "check_health",   description: "Get today's health summary from HealthKit", agent: healthAgent)
let tasksTool    = AgentTool(name: "check_tasks",    description: "Get overdue and high-priority Reminders",   agent: tasksAgent)

// The briefing agent calls all three and combines their output
let briefingAgent = Agent(
    model: provider,
    tools: [calendarTool, healthTool, tasksTool],
    systemPrompt: "You give the user a concise morning briefing. Call all three tools and synthesize their outputs into a prioritized plan for the day."
)

let briefing = try await briefingAgent.run("Good morning. What should I focus on today?")

Deep Dives