OAuth for iCloud developer guide

Give an Agent Permission to Run Home Scenes

Decide the agent's limits before the app asks for HomeKit permission: scenes it runs freely, scenes it confirms first, and scenes that stay human-only. Then enforce that classification in code.

Figment editorial teamPublished Updated Facts checked November 12, 2026

The safest way to give an AI agent access to HomeKit is to decide its limits before the app requests permission. Build an explicit allowlist (scenes the agent runs freely, scenes it asks about first, and scenes that stay human-only) and enforce that classification in code. The matrix below guides those decisions.

How does HomeKit permission work for an agent?

HomeKit grants access at the app level through a standard iOS or Mac Catalyst permission dialog. The entry point, HMHomeManager, is available on iOS, iPadOS, Mac Catalyst, tvOS, visionOS, and watchOS, not on native macOS outside of Mac Catalyst. An agent embedded in an iOS app or a Mac Catalyst target can request HomeKit access; a plain macOS daemon cannot call this API directly (HMHomeManager).

After the user grants permission, the app can read homes, accessories, and action sets (scenes). It cannot act on scenes beyond what the user configured in the Home app, and it cannot change home structure or add accessories without additional entitlements. The agent's reach is bounded by what is already in the Home app and what the agent code explicitly calls.

There is no Figment-supplied HomeKit connector or scope. The integration below is a developer-owned design using Apple's public HomeKit framework.

Do I need a home hub?

Yes, for background or off-device use. The user's home needs a compatible hub (HomePod, HomePod mini, or Apple TV) signed into the same Apple Account and connected to the home Wi-Fi network. iCloud Keychain and two-factor authentication are prerequisites for remote access. iPad is no longer supported as a home hub (Apple home hub requirements). Without a hub, scenes only trigger locally.

How do I sort scenes into an allowlist?

Define the allowed set before the app calls HMHomeManager, not after. This keeps the agent's reach explicit in code rather than assumed at runtime. Sort every scene in the home by what it does:

Reversible convenience
lights, speakers, non-critical climate. Undone in seconds, with no security surface.
Mixed
includes at least one lock, garage door, or security-arm action alongside convenience devices.
Physical access or alert
the primary effect is unlocking a door, triggering a siren, or escalating a security state.

Convenience-only scenes are candidates for free agent execution. Mixed scenes need a confirmation step. Physical-access and alert scenes stay off the agent's list entirely.

Which scenes should the agent run, confirm, or never touch?

Use this matrix to classify scenes before setup. Permit means the agent calls the scene on its own judgment. Confirm means it asks the user first. Exclude means the scene is not in the agent's allowed set at all.

Scene typeTypical accessoriesLevelReason
Ambience (Movie Night, Reading, Dinner)Lights (dim/color), speakersPermitFully reversible; no security surface
Morning RoutineLights, coffee maker, thermostatPermitReversible convenience; no locks
Arrive Home (lights + thermostat only)Lights, thermostatPermitReversible; exclude this scene if it includes a lock
Away / Leave Home (mixed)Lights off, thermostat setback, door lockConfirmLock state change; agent asks first
Good Night (mixed)Lights off, door lock, arm securityConfirmSecurity-critical; requires human confirmation
Guest AccessFront door lock or garage doorExcludePhysical access; always human-initiated
Security / AlarmSiren, alarm arm, camerasExcludeIrreversible alert; must stay human-only

If a scene spans two categories, split it. Create a lights-only "Leave Home – lights" version for the agent and keep the full version, locks and all, for the user.

How do I enforce the allowlist in code?

Persist the allowlist as a set of scene identifiers, using the uniqueIdentifier property of each HMActionSet the user has approved for agent use. At runtime:

  1. Check HMHomeManagerAuthorizationStatus before any scene call. If access is not .authorized, surface the system permission prompt and do not proceed silently.
  2. Filter through the allowlist. The agent only sees scenes whose identifiers appear in the Permit or Confirm set. Exclude-tier scenes are never surfaced to the agent.
  3. For Confirm-tier scenes, describe what the scene will do and require an explicit user acknowledgment before calling HMHome.executeActionSet(_:completionHandler:).
  4. Handle unknown outcomes. The HomeKit completion handler can return an error even when a hub is reachable. Surface failures clearly instead of retrying silently.

Keeping a scene out of the allowlist does not stop the user from running it manually in the Home app. It only means the agent cannot reach it.

How do I narrow or revoke the agent's access?

Update the allowlist in your app and redeploy. HomeKit permission is app-scoped, so tightening the confirmation tier needs no Home app change. To stop the app from accessing HomeKit entirely, the user revokes access in Settings → Privacy & Security → Home on iOS.

If a scene ends up in the wrong tier (for example, the agent ran an "Away" scene that also locked the front door), update the allowlist and tighten the confirmation logic before the next release.

What does Figment offer today?

Figment's OAuth for iCloud covers four scopes for connected Apple Accounts: Passwords, Messages, Notes, and Reminders. iMessage REST access is documented in detail, and a synthetic sandbox covers Contacts and Calendar. To explore available scopes and start a connection, see Connect Apple Account.

Connect Apple data to your app

Register your app and start with synthetic sandbox data. Choose the permissions your app needs.

Connect Apple Account

Sandbox is free. Live access is $14 or $29 per connected Apple Account, per month.