arazzo: 1.0.1 info: title: Zapier Run an AI Action summary: Discover an action on an app, resolve its input fields, run it, and poll for the result. description: >- The core Zapier AI Actions (Powered by Zapier) pattern. Given a connected app and authentication, the workflow lists the available actions for that app, fetches the input fields for the chosen action so the caller knows what to supply, kicks off an asynchronous action run, and then polls the action-run endpoint until it reports success or error. Each step spells out its request inline so the flow can be read and executed without opening the underlying OpenAPI description. version: 1.0.0 sourceDescriptions: - name: zapierPartnerApi url: ../openapi/zapier-partner-api.yml type: openapi workflows: - workflowId: run-ai-action summary: Run a single Zapier action against a third-party app and retrieve its result. description: >- Lists the actions exposed by an app, reads the input field definitions for a target action, creates an asynchronous action run with the supplied inputs, and polls the run until it completes. inputs: type: object required: - accessToken - appId - actionId - authentication - inputs properties: accessToken: type: string description: OAuth2 bearer token used in the Authorization header. appId: type: string description: Canonical App ID (UUID) as provided by the /apps endpoint. actionId: type: string description: The Action ID to run (e.g. uag:87b1c14e-ef30-43d5-9395-6c6514dbb123). authentication: type: string description: The Authentication ID that grants access to the third-party app. inputs: type: object description: Map of input field id/value pairs to pass to the action. steps: - stepId: listActions description: >- Fetch the actions available for the app so the target action id can be confirmed before running it. operationId: get-actions parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: app in: query value: $inputs.appId successCriteria: - condition: $statusCode == 200 outputs: actions: $response.body#/0/data - stepId: resolveInputFields description: >- Read the input field definitions for the target action so the caller knows which inputs are required before running it. operationId: get-fields-inputs parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: action_id in: path value: $inputs.actionId requestBody: contentType: application/json payload: data: authentication: $inputs.authentication inputs: $inputs.inputs successCriteria: - condition: $statusCode == 200 outputs: inputFields: $response.body#/data - stepId: createRun description: >- Create an asynchronous action run with the supplied authentication and inputs. The response returns the run id to poll. operationId: create-action-run parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" requestBody: contentType: application/json payload: data: action: $inputs.actionId authentication: $inputs.authentication inputs: $inputs.inputs successCriteria: - condition: $statusCode == 200 outputs: runId: $response.body#/data/id - stepId: pollRun description: >- Retrieve the action run and branch on its status: re-poll while it is still running, end on success, and surface a failure on error. operationId: retrieve-action-run parameters: - name: Authorization in: header value: "Bearer $inputs.accessToken" - name: id in: path value: $steps.createRun.outputs.runId successCriteria: - condition: $statusCode == 200 outputs: status: $response.body#/data/status results: $response.body#/data/results errors: $response.body#/data/errors onSuccess: - name: runStillPending type: goto stepId: pollRun criteria: - context: $response.body condition: $.data.status != 'success' && $.data.status != 'error' type: jsonpath - name: runSucceeded type: end criteria: - context: $response.body condition: $.data.status == 'success' type: jsonpath outputs: runId: $steps.createRun.outputs.runId status: $steps.pollRun.outputs.status results: $steps.pollRun.outputs.results