# Operate a Workflow

## **Setup Requirements**

* **Set up Inverter Network SDK**: Refer to the[ Quick Start](/sdk/typescript-sdk.md) guide for detailed instructions.
* **Deploy a Workflow**: Refer to the[ Deploy a Workflow](/sdk/typescript-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

**Parameters**

1. **`orchestratorAddress` (required)**:\
   The address of the orchestrator responsible for managing the workflow. This parameter must always be provided.
2. **`requestedModules` (optional)**:\
   Suggested to be included for end-to-end TypeScript coverage. This parameter provides additional context or configuration for the workflow's orientation.
3. `useTags` **(optional):**\
   This parameter is to optionally disable auto format parse for inputs and outputs (default true).

{% code overflow="wrap" %}

```typescript
import { sdk } from '<your_sdk_export>'

const { getWorkflow } = sdk

// Should either be `as const` or be passed dirrectly in the `requestedModules`
const requestedModules = {
    fundingManager: 'FM_DepositVault_v1',
    paymentProcessor: 'PP_Simple_v1',
    authorizer: 'AUT_Roles_v1',
    optionalModules: [
        'LM_PC_Bounties_v1', 'LM_PC_RecurringPayments_v1'
    ]
} as const satisfies MixedRequestedModules

const workflow = await getWorkflow({
    orchestratorAddress: '0x8a1897E6Fa0236F68f86240C391D2a7bED3Cf85c',
    requestedModules
});

const { 
    orchestrator, 
    authorizer,
    fundingManager,
    optionalModule,
    fundingToken
} = workflow
```

{% endcode %}

## Reading Data

You can read data from any of the modules as shown below. In this example, we are retrieving the `totalSupply` of the fundingToken:

{% code overflow="wrap" %}

```typescript
const totalSupply = await workflow.fundingToken.module.read.totalSupply.run();
```

{% endcode %}

## Writing Data

You can write data to any of the modules as shown below. In this example, we are making a deposit to the funding manager:

{% code overflow="wrap" %}

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

{% 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/typescript-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.
