<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Automator",
  "identifier" : "/documentation/Automator/AMWorkflow",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Automator"
    ],
    "preciseIdentifier" : "c:objc(cs)AMWorkflow"
  },
  "title" : "AMWorkflow"
}
-->

# AMWorkflow

An object that lets you use an Automator workflow in your app.

```
class AMWorkflow
```

## Overview

A *workflow* consists of one or more actions, discrete tasks which together can perform complex automation tasks. Your app can use workflows to package its own features and to take advantage of features provided by other apps. You create actions with Xcode, while you create workflows with the Automator app.

You can load and run a workflow with minimal overhead by using the class method [`run(at:withInput:)`](/documentation/Automator/AMWorkflow/run(at:withInput:)). However, in situations where you need greater control, such as the ability to start and stop the workflow, you can use an instance of the [`AMWorkflowController`](/documentation/Automator/AMWorkflowController) class instead. In that case, you must create and initialize both the workflow and the workflow controller objects.

In either case, the workflow runs in a separate process so that any actions it contains are executed in a separate memory space.  That helps to insulate your app from crashes, memory leaks, or exceptions that might occur from running the actions in the workflow.

You can display a workflow with an instance of [`AMWorkflowView`](/documentation/Automator/AMWorkflowView).

## Topics

### Creating a Workflow

[`-  init`](/documentation/Automator/AMWorkflow/init())

Creates and initializes a workflow.

[`-  initWithContentsOfURL:error:`](/documentation/Automator/AMWorkflow/init(contentsOf:))

Creates and initializes a workflow based on the contents of the specified file.

### Running a Workflow

[`+  runWorkflowAtURL:withInput:error:`](/documentation/Automator/AMWorkflow/run(at:withInput:))

Loads and runs the specified workflow file.

### Saving Changes to a Workflow

[`-  writeToURL:error:`](/documentation/Automator/AMWorkflow/write(to:))

Writes the workflow to the specified file.

### Getting Information About a Workflow

[`actions`](/documentation/Automator/AMWorkflow/actions)

An array of the workflow’s actions.

[`fileURL`](/documentation/Automator/AMWorkflow/fileURL)

A URL that specifies the location of the workflow file.

[`-  valueForVariableWithName:`](/documentation/Automator/AMWorkflow/valueForVariable(withName:))

Returns the value of the workflow variable with the specified name.

### Working with the Workflow’s Input and Output

[`input`](/documentation/Automator/AMWorkflow/input)

The input data that is passed to the first action in the workflow.

[`output`](/documentation/Automator/AMWorkflow/output)

The output data that is provided by the last action in the workflow.

### Manipulating the Workflow

[`-  setValue:forVariableWithName:`](/documentation/Automator/AMWorkflow/setValue(_:forVariableWithName:))

Sets the value of the workflow variable with the specified name.

### Manipulating the Workflow’s Actions

[`-  addAction:`](/documentation/Automator/AMWorkflow/addAction(_:))

Adds the specified action at the end of the receiving workflow.

[`-  insertAction:atIndex:`](/documentation/Automator/AMWorkflow/insertAction(_:at:))

Inserts the specified action at the specified position of the receiving workflow.

[`-  moveActionAtIndex:toIndex:`](/documentation/Automator/AMWorkflow/moveAction(at:to:))

Moves the action from the specified start position to the specified end position in the receiving workflow.

[`-  removeAction:`](/documentation/Automator/AMWorkflow/removeAction(_:))

Removes the specified action from the workflow.

## Relationships

### Conforms To

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

[`Equatable`](/documentation/Swift/Equatable)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)