## Executive Summary

Most consumer and enterprise AI applications are constrained to text chat boxes. Users are forced to manually transcribe answers, toggle settings, and click buttons. In mobile development, this paradigm is especially inadequate: mobile devices are rich sensor platforms equipped with cameras, microphones, GPS, accelerometers, calendars, and local hardware neural engines (NPUs). Mobile users do not want to chat with an app; **they want the app to act**.

In this session, Gerald Versluis introduces the **"Action Over Chat"** architecture for .NET MAUI applications. Rather than presenting a chatbot sidecar, developers can use AI as an intelligent intent router and actuator that drives the application's native user interface, navigates views, adjusts filters, manages data, and performs complex multi-step workflows on behalf of the user.

Versluis details the new **Essentials.AI** library from .NET MAUI Labs (`github.com/dotnet/maui-labs`), which provides a unified, cross-platform abstraction over on-device hardware models—including **Apple Intelligence** on iOS/macOS, **Google Gemini Nano** on Android, and **Windows Copilot/AI**—standardized on `Microsoft.Extensions.AI` (`IChatClient`). Through declarative **AI Attributes** (`[ExportAIFunction]`), developers turn standard C# methods into source-generated, reflection-free tools that models can invoke deterministically. Versluis demonstrates these patterns live in the official **.NET Conf 2026 Mobile App**, showing natural language schedule construction, bulk data manipulation, intent-driven navigation, and safety guardrails with human-in-the-loop approval dialogs.

---

## Visual Timeline & Key Moments

| Timestamp | Screenshot | Core Technical Topic |
|---|---|---|
| `00:00:15` | [01-title-less-chat-more-action-maui.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/01-title-less-chat-more-action-maui.webp) | Session introduction: Gerald Versluis on building AI-powered .NET MAUI apps that act rather than just chat. |
| `00:01:30` | [02-mobile-sensors-as-ai-context.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/02-mobile-sensors-as-ai-context.webp) | Mobile devices as multimodal context engines: camera, microphone, GPS geolocation, and calendars. |
| `00:03:30` | [03-action-over-chat-concept.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/03-action-over-chat-concept.webp) | The "Action Over Chat" concept: transforming natural language queries into automated UI state changes. |
| `00:04:45` | [04-demo-app-onboarding-experience.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/04-demo-app-onboarding-experience.webp) | Official .NET Conf 2026 App onboarding: profiling developer interests via on-device AI. |
| `00:06:40` | [05-demo-ai-natural-schedule-builder.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/05-demo-ai-natural-schedule-builder.webp) | Demo: Specifying interests ("Daniel Roth and .NET MAUI") with timezone offsets and watch hours. |
| `00:08:20` | [06-microsoft-extensions-ai-ichatclient.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/06-microsoft-extensions-ai-ichatclient.webp) | The core abstraction: `Microsoft.Extensions.AI` (`IChatClient`), function invocation, and OpenTelemetry. |
| `00:10:00` | [07-full-architectural-stack-diagram.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/07-full-architectural-stack-diagram.webp) | Full architectural stack: Pages/ViewModels -> AI Attributes -> M.E.AI -> Essentials.AI vs. Cloud. |
| `00:12:30` | [08-evolution-from-essentials-to-essentials-ai.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/08-evolution-from-essentials-to-essentials-ai.webp) | History: Evolution from Xamarin.Essentials to MAUI Essentials to on-device `Essentials.AI`. |
| `00:14:15` | [09-code-registering-ichatclient-maui-program.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/09-code-registering-ichatclient-maui-program.webp) | Code: Registering platform-specific `IChatClient` (Apple Intelligence / Gemini Nano) in `MauiProgram.cs`. |
| `00:16:15` | [10-model-tradeoffs-on-device-onnx-cloud.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/10-model-tradeoffs-on-device-onnx-cloud.webp) | Model Tradeoffs: On-Device (Free/Private) vs. Local ONNX Models vs. Premier Cloud Inference. |
| `00:18:25` | [11-hybrid-per-feature-ai-strategy.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/11-hybrid-per-feature-ai-strategy.webp) | Architectural Strategy: Per-feature hybrid AI splitting local chat clients from remote cloud clients. |
| `00:20:15` | [12-platform-ai-hardware-matrix.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/12-platform-ai-hardware-matrix.webp) | Platform capability matrix: Tool calling support across Apple Intelligence, Gemini Nano v4, and Windows. |
| `00:21:45` | [13-code-ai-attributes-exportaifunction.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/13-code-ai-attributes-exportaifunction.webp) | Code: `[ExportAIFunction]` and parameter descriptions turning standard C# methods into AI tools. |
| `00:24:45` | [14-demo-blazor-thursday-auto-navigation.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/14-demo-blazor-thursday-auto-navigation.webp) | Live Demo: "Blazor talks on Thursday" -> Agent automatically switches tabs and applies active filters. |
| `00:26:40` | [15-demo-bulk-saving-aspire-sessions.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/15-demo-bulk-saving-aspire-sessions.webp) | Live Demo: "Save all Aspire sessions" -> Bulk hearting sessions; schedule counter updates 9 -> 15. |
| `00:27:50` | [16-demo-human-in-the-loop-destructive-confirm.jpg](/dotnetconf2026/archive/40-ai-powered-dotnet-maui-apps/screenshots/16-demo-human-in-the-loop-destructive-confirm.webp) | Live Demo: Destructive removal requires explicit confirmation (`[ApprovalRequired]` guardrail). |

---

## 1. The Core Paradigm: Action Over Chat

In traditional mobile apps, developers treat AI as an isolated conversational bubble:
```
User Prompt ──> [Chat Window] ──> Text Response ──> User Manually Navigates & Clicks
```

In modern .NET MAUI applications, AI becomes an **intelligent actuator**:
```
User Intent ──> [On-Device SLM] ──> Invokes C# Tool ──> App Mutates ViewModels & Navigates
```

### Why Mobile Devices are the Ideal AI Surface
1. **Sensors as Grounded Context:** Unlike desktop browsers where context is limited to typed text, mobile apps have access to native hardware sensors:
   - **Camera / Vision:** Capturing menus, receipts, serial numbers, or barcodes.
   - **Microphone / Speech:** Low-latency voice intent capture.
   - **GPS Geolocation:** Contextualizing requests (e.g. assessing food allergy risk based on regional cuisine).
   - **Calendar & Alarms:** Checking user availability, scheduling watch sessions, triggering notifications.
   - **Battery & Network Constraints:** Deciding whether to run on-device inference or call cloud endpoints based on battery level and Wi-Fi state.

---

## 2. The Architectural Stack for AI in .NET MAUI

The architecture separates UI components from inference engines using standardized abstractions:

```mermaid
flowchart TD
    subgraph AppLayer["Application Layer"]
        Views["MAUI Pages & Controls"]
        VMs["Mvvm ViewModels & Services"]
        Tools["AskTools.cs (Business Logic)"]
    end

    subgraph ToolingLayer["AI Tooling Layer"]
        AIAttrib["AI Attributes: [ExportAIFunction]"]
        SrcGen["Roslyn Source Generator (Zero Reflection, AOT Safe)"]
    end

    subgraph AbstractionLayer["Abstraction Layer: Microsoft.Extensions.AI"]
        IChat["IChatClient"]
        FuncInv["Function Invocation Pipeline"]
        OTel["OpenTelemetry Instrumentation"]
    end

    subgraph BackendLayer["Inference Execution Engines"]
        subgraph Local["On-Device Private & Free"]
            EssAI["Essentials.AI (MAUI Labs)"]
            Apple["Apple Intelligence (iOS/macOS)"]
            Gemini["Gemini Nano (Android AICore)"]
            WinAI["Windows Copilot / AI"]
            ONNX["ONNX Runtime (.NET Local Models)"]
        end
        subgraph Cloud["Cloud Premier & Scalable"]
            Foundry["Microsoft AI Foundry"]
            Gateway["Azure AI Gateway / OpenAI"]
        end
    end

    AppLayer --> AIAttrib --> SrcGen --> IChat
    IChat --> FuncInv --> OTel
    OTel --> EssAI
    OTel --> ONNX
    OTel --> Cloud
    EssAI --> Apple
    EssAI --> Gemini
    EssAI --> WinAI
```

---

## 3. `Essentials.AI`: Unified Cross-Platform On-Device AI

Just as **Xamarin.Essentials** (and subsequently **MAUI Essentials**) unified device hardware APIs (geolocation, compass, battery, flashlight) under a single C# namespace, **`Essentials.AI`** (released via .NET MAUI Labs) unifies native platform neural models:

### Registration in `MauiProgram.cs`
Developers register `IChatClient` in their dependency injection container using conditional platform compilation:

```csharp
// MauiProgram.cs
public static MauiApp CreateMauiApp()
{
    var builder = MauiApp.CreateBuilder();
    builder
        .UseMauiApp<App>()
        .ConfigureFonts(...);

    // Register platform-native on-device IChatClient:
#if IOS || MACCATALYST
    builder.Services.AddSingleton<IChatClient, AppleIntelligenceChatClient>();
#elif ANDROID
    builder.Services.AddSingleton<IChatClient, GeminiNanoChatClient>();
#elif WINDOWS
    builder.Services.AddSingleton<IChatClient, WindowsAIChatClient>();
#else
    // Fallback to cloud inference if hardware SLM is unavailable
    builder.Services.AddSingleton<IChatClient>(sp => 
        new AzureOpenAIClient(endpoint, credential).AsChatClient("gpt-4o-mini"));
#endif

    return builder.Build();
}
```

### Model Spectrum & Tradeoffs

| Capability | Tier 1: On-Device Built-In (`Essentials.AI`) | Tier 2: Bring Your Own Model (ONNX Runtime) | Tier 3: Premier Cloud Models (Foundry / OpenAI) |
|---|---|---|---|
| **Cost** | **$0.00 (Completely Free)** | $0.00 (Local compute) | Pay-per-token API fees |
| **Privacy** | **100% Private (Zero data leaves device)** | 100% Private | Data sent over TLS to cloud endpoint |
| **Offline Support** | **Full offline capability** | Full offline capability | Requires active internet connection |
| **App Binary Footprint** | **0 MB added (Uses OS-level model)** | Adds 500 MB – 4 GB model weights to app package | **0 MB added (Pure HTTP/JSON-RPC)** |
| **Reasoning Power** | Moderate (SLM: 2B–4B parameters) | High (Depends on selected model) | **Very High (Frontier LLMs)** |
| **Tool Calling Status** | iOS: Supported; Android: Nano v4; Win: Soon | Dependent on model architecture | Native, mature support |

---

## 4. The Per-Feature Hybrid AI Strategy

Rather than making an all-or-nothing choice between on-device and cloud AI, Versluis advocates for a **Per-Feature Hybrid Strategy**:

```mermaid
flowchart LR
    UserInput["User Request"] --> Dispatcher{"Intent Complexity"}
    
    Dispatcher -- "Simple Navigation, Filters, Intent Routing" --> LocalClient["ILocalChatClient (On-Device)<br/>• Fast, 0-latency<br/>• Free, offline<br/>• Hardware NPU"]
    
    Dispatcher -- "Deep Multi-Doc Synthesis, Summaries, Translations" --> RemoteClient["IRemoteChatClient (Cloud)<br/>• Frontier LLM reasoning<br/>• Large context window<br/>• Multi-modal generation"]

    LocalClient --> AppAction["App Actuation & UI Update"]
    RemoteClient --> AppAction
```

By injecting both `ILocalChatClient` and `IRemoteChatClient`, a mobile app routes quick UI manipulations (like "switch to Thursday and filter by Blazor") through the local hardware NPU with zero token cost, while reserving cloud calls for heavy summarization or translation tasks.

---

## 5. Declarative Tooling with AI Attributes

To allow models to trigger application actions, developers decorate C# methods with **AI Attributes**:

```csharp
public class AskTools
{
    private readonly IScheduleService _scheduleService;
    private readonly INavigationService _navigationService;

    public AskTools(IScheduleService scheduleService, INavigationService navigationService)
    {
        _scheduleService = scheduleService;
        _navigationService = navigationService;
    }

    [ExportAIFunction("filter_schedule", Description = "Filters the conference schedule by topic keyword and specific day of the week.")]
    public async Task FilterScheduleAsync(
        [Description("The day of the conference to filter by, e.g., 'Tuesday', 'Wednesday', 'Thursday'.")] string day,
        [Description("The technical topic or keyword to filter by, e.g., 'Blazor', 'Aspire', 'MAUI'.")] string topic)
    {
        // Tools stage actions through existing ViewModel and Navigation abstractions:
        await _navigationService.NavigateToAsync("//schedule");
        await _scheduleService.ApplyFilterAsync(day, topic);
    }

    [ExportAIFunction("open_speaker", Description = "Opens the detailed speaker profile page for a given presenter name.")]
    public async Task OpenSpeakerProfileAsync(
        [Description("The full or partial name of the speaker to view, e.g. 'Daniel Roth'.")] string speakerName)
    {
        await _navigationService.NavigateToAsync($"//speakers/details?name={Uri.EscapeDataString(speakerName)}");
    }

    [ApprovalRequired] // Enforces Human-in-the-Loop Confirmation Dialog!
    [ExportAIFunction("remove_sessions_by_topic", Description = "Removes all scheduled sessions matching a specific topic from the user's personal calendar.")]
    public async Task<int> RemoveSessionsByTopicAsync(
        [Description("The topic of sessions to remove, e.g. 'Aspire'.")] string topic)
    {
        return await _scheduleService.RemoveByTopicAsync(topic);
    }
}
```

### Key Implementation Principles
1. **Source Generation (No Reflection):** The attribute triggers a Roslyn source generator that emits strongly typed invocation dispatchers. This is critical for mobile platforms (iOS and Android) where runtime reflection causes trimming issues and violates ahead-of-time (AOT) constraints.
2. **Action Staging:** Tools do not touch UI widgets directly; they invoke services and mutate ViewModels. The UI updates reactively via standard data binding.
3. **Rich Descriptions for LLM Grounding:** Parameter descriptions enable the model to infer parameters from informal, messy user phrasing.

---

## 6. Live Demos in the .NET Conf 2026 Mobile App

Versluis showcases several end-to-end scenarios running on iOS hardware:

### Demo 1: Intent-Driven UI Filtering
- **User Prompt:** *"Blazor talks on Thursday"*
- **Traditional UI:** Returns an inline text list or markdown message.
- **Action-Driven Result:** The agent invokes `filter_schedule(day: "Thursday", topic: "Blazor")`. The app switches tabs to the Schedule view, sets the active day selector to **Thursday**, and populates the search bar with **"Blazor"**.

### Demo 2: Bulk Data Manipulation
- **User Prompt:** *"Save all the Aspire sessions"*
- **Action-Driven Result:** The agent queries the session catalog, identifies 6 Aspire sessions, adds heart icons to all of them, increments the user's personal schedule counter from **9 to 15**, and displays the updated schedule.

### Demo 3: Deep-Link Navigation by Intent
- **User Prompt:** *"Open Daniel Roth"* or *"Open Introducing BlazorKit"*
- **Action-Driven Result:** Resolves the presenter/session entity and navigates directly to the deep-linked detail page without requiring the user to traverse speaker indexes.

### Demo 4: Destructive Action with `[ApprovalRequired]`
- **User Prompt:** *"Remove all the Aspire sessions"*
- **Safety Guardrail:** Because the method is decorated with `[ApprovalRequired]`, the app pauses execution and displays a native modal confirmation dialog:
  ```
  ┌────────────────────────────────────────────────────────┐
  │                 CONFIRMATION REQUIRED                  │
  │ Are you sure you want to remove 9 Aspire sessions      │
  │ from your personal schedule?                           │
  │                                                        │
  │          [Keep in Schedule]     [Remove Sessions]      │
  └────────────────────────────────────────────────────────┘
  ```
  Only after the user explicitly taps **"Remove Sessions"** does the model complete execution, reducing the schedule count from **16 to 7**.

### Demo 5: Intelligent Gap Scheduling
- **User Prompt:** *"Find sessions for the gaps"*
- **Action-Driven Result:** Scans the user's schedule for a 5-hour-and-30-minute unscheduled block, cross-references user-defined watch hours (e.g. 7:00 AM – 11:00 PM CET), and presents 12 candidate talks that fit the open time slots without overlapping existing appointments.

---

## 7. Safety, Security, and Future Frontiers

### Security Guidelines for Agentic Mobile Apps
- **Validate Arguments:** Never trust raw strings emitted by models; validate all inputs against known IDs, enums, or sanitizers to prevent prompt injections.
- **Least Privilege Exposure:** Expose only safe, intended methods as AI tools. Do not blindly expose database mutations or administrative controls.
- **Explicit Confirmation for Destructive Actions:** Always gate state deletions, credit card transactions, or irreversible removals behind native confirmation dialogs.

### Future Horizons in .NET MAUI Labs
- **Semantic Search:** Generating on-device vector embeddings for conceptual matching (e.g., finding "mobile performance" talks when searching for "snappy phone apps").
- **AI Wayfinding:** Navigating applications entirely by semantic intent rather than hierarchical nested hamburger menus.
- **Generative Dynamic UI:** Moving beyond static XAML templates by allowing models to compose custom reactive layouts (e.g. dynamic mosaic grids) based on personalized user preferences.

---

## Technical Recommendations for .NET MAUI Developers

1. **Stop Building Chat Windows:** Integrate AI directly into existing ViewModels and navigation stacks so the agent operates the app alongside the user.
2. **Leverage `Essentials.AI` for Zero-Cost Inference:** Evaluate on-device models (Apple Intelligence and Gemini Nano) via `Essentials.AI` before incurring recurring cloud API token costs.
3. **Decorate Tools with Clear Descriptions:** Treat `[Description]` attributes on methods and parameters as the primary API documentation for the model.
4. **Enforce `[ApprovalRequired]` on Mutating State:** Always require explicit user confirmation before executing destructive or irreversible operations.
