RunFigraniumTaskTool, a constrained Foundation Models tool that lets Apple Intelligence invoke pre-approved browser automation tasks. The tool is compiled only when FoundationModels and FoundationModelsMacros are available, so it does not affect builds on earlier platforms.
This feature requires
import FoundationModels and the @Generable macro from FoundationModelsMacros. It is unavailable on tvOS, watchOS, and earlier Apple platform versions.Tool overview
RunFigraniumTaskTool exposes a single callable action named run_figranium_task. The model can only invoke tasks you explicitly allow through allowedTaskIDs. The tool returns a JSON-encoded ExecutionResult<JSONValue> string, so the model receives structured outcome data without direct access to browser internals or credentials.
RunFigraniumTaskTool.swift
String
required
The identifier of a pre-approved Figranium task to run. The model receives this as a guided parameter.
ExecutionResult<JSONValue> string. If encoding fails, it returns "{}".
Throws: FigraniumError with code TASK_NOT_ALLOWED if the requested taskID is not in allowedTaskIDs.
Attach the tool to a language model session
Create a tool instance with your client and an allowlist, then pass it into aLanguageModelSession.
FoundationModelsExample.swift
taskID is exposed, the model cannot construct arbitrary actions or access credentials.