# Operate a Workflow

## **Setup Requirements**

* **Set up Inverter Network SDK**: Refer to the[ Quick Start](/sdk/react-sdk.md) guide for detailed instructions.
* **Deploy a Workflow**: Refer to the[ Deploy a Workflow](/sdk/react-sdk/deploy-a-workflow.md) guide for detailed instructions.

{% hint style="info" %}
*( optional )* You can pass in a ModuleData typed object into the `requestedModules` constant's fields, this makes it so that you can work with your self managed inverter modules
{% endhint %}

```typescript
// EXEMPLE MixedRequestedModules USAGE
import type { ModuleData, MixedRequestedModules } from '@inverter-network/sdk'

const AUT_Roles_v1 = {'<your_module_data>'} as const satisifies ModuleData

const requestedModules = {
    fundingManager: 'FM_DepositVault_v1',
    paymentProcessor: 'PP_Simple_v1',
    authorizer: AUT_Roles_v1,
} as const satisfies MixedRequestedModules
```

***

## Retrieving a Workflow

We strongly recommend passing in a `readonly requestedModules` since this ensures that your `workflow` response will be strongly typed. Also you will have to pass in a `orchestratorAddress` in to the query.

**Parameters**

* **`requestedModules` (required)**:\
  This parameter defines the modules which will be deployed.
* `useTags` **(optional):**\
  This parameter is to optionally disable auto format parse for inputs and outputs (default true).

{% code overflow="wrap" %}

```typescript
'use client'

import { useWorkflow } from '@inverter-network/react/client'
import type { MixedRequestedModules } from '@inverter-network/sdk'

import { Button } from '@/components/ui/button'
import { useMutation } from '@tanstack/react-query'

// Defined the modules to be used in the workflow in typesafe manner
const requestedModules = {
  fundingManager: 'FM_DepositVault_v1',
  paymentProcessor: 'PP_Simple_v1',
  authorizer: 'AUT_Roles_v1',
  optionalModules: ['LM_PC_Bounties_v1'],
} as const satisfies MixedRequestedModules

export default function Page() {
  const workflow = useWorkflow({
    orchestratorAddress: '<your_orchestrator_address>',
    requestedModules,
  })

  // Setup a read mutation to run the workflow function
  const readTitle = useMutation({
    mutationFn: async () => {
      if (!workflow.data) throw new Error('No workflow instance found')

      return await workflow.data.fundingManager.read.title.run()
    },
  })
  
  // Setup a write mutation to run the workflow function
  const deposit = useMutation({
    mutationFn: async () => {
      if (!workflow.data) throw new Error('No workflow instance found')

      return await workflow.fundingManager.write.deposit.run('100', {
          confirmations: 1,
          onHash: (hash) => {console.log(hash)},
          onConfirmation: (receipt) => {console.log(receipt)},
          onApprove: (receipts) => {console.log(receipts)}
      })
    },
  })
  

  // Return a simple ui to trigger the flow
  return (
    <form
      className="w-screen h-screen flex flex-col items-center justify-center gap-3"
      onSubmit={(e) => {
        e.preventDefault()
        readTitle.mutate()
        deposit.mutate()
      }}
    >
      <h1>Funding Manager Title: {readTitle?.data ?? 'No Data Yet...'}</h1>
      
      <h1>Deposit Transaction Hash: {deposit?.data ?? 'No Data Yet...'}</h1>

      <Button type="submit" loading={readTitle.isPending}>
        Read
      </Button>
    </form>
  )
}
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inverter.network/sdk/react-sdk/operate-a-workflow.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
