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

# run(at:withInput:)

Loads and runs the specified workflow file.

```
class func run(at fileURL: URL, withInput input: Any?) throws -> Any
```

## Parameters

`fileURL`

A URL that specifies the location of a workflow file.

`input`

The input for the first action in the workflow. Pass `nil` if the first action doesn’t need input.

## Return Value

This method returns `nil` on error, or if the action completes successfully without producing output. The error argument must be examined to determine which scenario occurred. Otherwise, this method returns the output of the last action in the workflow. Your application may need to convert the data to a desired type.

## Discussion

Use this method to run a workflow without the overhead of performing a separate allocation, setting up a workflow controller, and so on. In situations where you need greater control, such as the ability to start and stop the workflow, use an instance of the [`AMWorkflowController`](/documentation/Automator/AMWorkflowController) class instead.

The workflow is run in a separate process so that any actions it contains are executed in a separate memory space.  This helps to insulate the app from crashes, memory leaks, or exceptions that might occur from running the actions in the workflow.

---

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)