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.
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:
Graph DAG
- Workflow is known up front
- Independent nodes run in parallel
- Dependent nodes wait automatically
- Run multiple focused agents on the same data simultaneously
Swarm Dynamic
- Routing decided by the model
- A coordinator agent hands off to whichever specialist fits
- Handles open-ended user requests
- Flexible but less predictable
A2A HTTP
- Your app's local agent delegates heavy work to a cloud agent your team hosts
- Remote agent looks like a local tool
- Backend can be Python or TypeScript Strands SDK
- Private tasks stay on device; intensive tasks go to the backend
Choosing a Coordination Model
| Situation | Use |
|---|---|
| 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 runs | A2A |
| Your backend team uses Python or TypeScript Strands and you want to call their agent from your app | A2A |
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:
// 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?")