AI & DevelopmentDeveloper Tools

Foundation Models Dynamic Profiles: Multi-Agent iOS Guide

Apple Foundation Models Dynamic Profiles API diagram showing multi-agent iOS session with swappable model profiles and shared transcript context
Dynamic Profiles let iOS apps swap AI models mid-session without losing transcript context — WWDC 2026

Apple solved a problem at WWDC 2026 that has frustrated every iOS developer building multi-agent apps: when you switch AI models mid-session, you lose your transcript. Your user uploads a photo, the on-device model analyzes it, and the moment you want a more capable model to act on that analysis, you start a new session from scratch — context gone. Dynamic Profiles fix this. Introduced in the Foundation Models framework update at WWDC 2026, it is a declarative API that lets you swap models, tools, and instructions on the fly while the transcript keeps rolling. One session, multiple model personalities, zero context loss.

The Problem Dynamic Profiles Solves

Before this API, building a task-routing agent in iOS meant managing multiple LanguageModelSession instances and manually passing context between them. You serialized conversation history, extracted relevant state, and rebuilt prompts for each model transition. It worked, but it was fragile — you decided what context to carry and inevitably got it wrong.

Dynamic Profiles make the framework own that problem. One session, one transcript, and the “active personality” — the model plus its instructions and tools — changes declaratively per prompt. The framework handles the transitions; you handle the logic of when to switch.

The DynamicProfile Protocol

Implementation is minimal. Declare a struct, conform it to DynamicProfile, and implement a body property that returns a Profile. A Profile takes a model, a string of instructions, optional tools, and optional modifiers. The body is re-evaluated on each prompt, which is what makes switching declarative rather than imperative.

struct TaskRouter: DynamicProfile {
    var complexity: TaskComplexity

    enum TaskComplexity { case simple, complex }

    var body: some DynamicInstructions {
        switch complexity {
        case .simple:
            Profile(SystemLanguageModel.default) {
                "Answer concisely. Extract key facts."
            }
        case .complex:
            Profile(PrivateCloudComputeModel()) {
                "Reason carefully. Consider tradeoffs and edge cases."
            } modifiers: {
                Temperature(0.7)
                DeepReasoning(level: .high)
            }
        }
    }
}

// Initialize with a profile
let session = LanguageModelSession(profile: TaskRouter(complexity: .simple))
let summary = try await session.respond(to: userInput)

// Escalate — the transcript from the simple pass is still there
if needsDeepAnalysis(summary) {
    session.profile = TaskRouter(complexity: .complex)
    let analysis = try await session.respond(to: "Now reason through the implications")
}

Notice that the second respond call can reference prior context without re-sending the original input. The prior exchange is in the shared transcript. This is the feature.

Choosing the Right Model for Each Profile

The framework gives you three model tiers to route between. SystemLanguageModel.default runs entirely on-device — fast, free, and private. PrivateCloudComputeModel() routes to Apple’s Private Cloud Compute infrastructure, offering stronger reasoning with the same privacy guarantees; apps with fewer than two million first-time downloads get this at no API cost under the Small Business Program. The third tier is any LLM you connect via the LanguageModel Protocol — Claude, Gemini, or a custom endpoint.

The practical rule: start on-device for everything and escalate when reasoning depth demands it. Use the third-party tier only for specialized domains where Apple’s models genuinely fall short. Unnecessary cloud calls are a cost and latency tax you pay on every session.

Composable Skills with DynamicInstructions

DynamicInstructions is the companion primitive. Where DynamicProfile defines the top-level session behavior, DynamicInstructions lets you group instructions and tools into reusable components. Nesting one inside another concatenates both instruction strings and tool registrations — so you build a library of skills that compose cleanly.

Apple shipped an open-source Swift package, foundation-models-utilities, that houses experimental agentic patterns backed by dynamic profiles. It updates between iOS releases, which means you get access to emerging APIs before they land in the main SDK. If you are building anything agentic on Apple platforms, add this package to your project now.

Context Management and Design Considerations

Long sessions accumulate transcript entries fast. The framework ships three modifiers to manage this: .summarizeHistory() automatically compresses older turns into a summary, .rollingWindow() keeps the last N turns and drops the rest, and .droppingCompletedToolCalls() removes resolved tool call entries that are no longer contextually relevant. Apply these in your Profile modifier block based on session duration and memory pressure.

Privacy boundaries matter when designing profiles. On-device profiles never leave the device. Private Cloud Compute requests are end-to-end encrypted and Apple does not retain them. If you are handling sensitive data, design your profiles so that sensitive transcript turns stay within on-device profiles — use context trimming before escalating to cloud models.

What to Build Next

Apple also shipped the Evaluations framework at WWDC 2026, specifically designed to test agentic workflows. Define a dataset of expected tool call trajectories, run ToolCallEvaluator, and get results inline in Xcode. Multi-agent apps that use Dynamic Profiles are exactly the use case it targets. Start with WWDC26 Session 241 for the framework overview and Session 242 for the deep dive into agentic patterns. The sample app Apple ships with Session 242 shows a complete multi-stage agent — worth running before you write a line of your own code.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *