> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inworld.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Inworld Framework Module

[Overview](../overview) > Inworld Framework Module

**Class:** `InworldFrameworkModule` | **Inherits from:** `MonoBehaviour`

Base class for a component that governs a feature of the InworldSDK.

Abstract base class for all Inworld framework modules within Unity. Provides common functionality for module initialization, configuration, and lifecycle management. Manages the creation and coordination of factories, configurations, interfaces, and nodes.

## Properties

* [ModelType](#modeltype)
* [Interface](#interface)
* [Graph](#graph)
* [Node](#node)
* [Initialized](#initialized)

## Methods

* [CreateFactory](#createfactory)
* [SetupConfig](#setupconfig)
* [Initialize](#initialize)
* [InitializeAsync](#initializeasync)

## Events

* [OnInitialized](#oninitialized)
* [OnTeminated](#onteminated)
* [OnTaskStarted](#ontaskstarted)
* [OnTask](#ontask)
* [OnTaskFinished](#ontaskfinished)
* [OnTaskCancelled](#ontaskcancelled)

## Reference

### ModelType

Gets or sets the model type for this module (Remote or Local).
Determines whether the module uses cloud-based or on-device AI models.

#### Returns

**Type:** `ModelType`

***

### Interface

Gets the active interface instance for this module.
Returns null if the module is not initialized.

#### Returns

**Type:** `InworldInterface`

***

### Graph

Gets the active graph instance associated with this module.

#### Returns

**Type:** `InworldGraph`

***

### Node

Gets the active node instance associated with this module.

#### Returns

**Type:** `InworldNode`

***

### Initialized

Gets or sets the initialization state of this module.
When set to true, triggers OnInitialized event if interface is available.
When set to false, cleans up interface and triggers OnTerminated event.

#### Returns

**Type:** `bool`

***

### CreateFactory

Creates and returns a factory instance specific to this module type.
Must be implemented by derived classes to provide appropriate factory creation.

#### Returns

**Type:** `InworldFactory`

**Description:** A factory instance for creating module-specific objects.

***

### SetupConfig

Sets up and returns a configuration instance specific to this module type.
Must be implemented by derived classes to provide appropriate configuration.

#### Returns

**Type:** `InworldConfig`

**Description:** A configuration instance for module initialization.

***

### Initialize

Initializes the module synchronously by creating factory, configuration, and interface.
Sets up the complete module pipeline required for operation.

#### Returns

**Type:** `bool`

**Description:** True if initialization succeeded, false otherwise.

***

### InitializeAsync

Initializes the module asynchronously by creating factory, configuration, and interface.
Performs interface creation on a background thread for improved performance.

#### Returns

**Type:** `Awaitable<bool>`

**Description:** A task that completes with true if initialization succeeded, false otherwise.

***

### OnInitialized

Event triggered when the module has been successfully initialized.

#### Parameters

None

***

### OnTeminated

Event triggered when the module has been terminated or disposed.

#### Parameters

None

***

### OnTaskStarted

Event triggered when a task has started execution.

#### Parameters

None

***

### OnTask

Event triggered during task execution with status updates.

#### Parameters

| Parameter | Type     | Description                                          |
| --------- | -------- | ---------------------------------------------------- |
| text      | `string` | The status message describing current task progress. |

***

### OnTaskFinished

Event triggered when a task has finished execution.

#### Parameters

| Parameter | Type     | Description                                     |
| --------- | -------- | ----------------------------------------------- |
| text      | `string` | The completion message describing task results. |

***

### OnTaskCancelled

Event triggered when a task has been cancelled.

#### Parameters

None

***

## Serialized Fields

The following fields are configurable in the Unity Inspector:

* **m\_ModelType** (`ModelType`) - The model type for this module (default: Remote)

## Important Notes

### Abstract Implementation Requirements

Derived classes must implement:

* `CreateFactory()` - Provide module-specific factory creation. Typically, this sets up an InworldInterface for the module, which directly interacts with the DLL through InworldInterop.
* `SetupConfig()` - Provide module-specific configuration setup

### Model Type Support

The module supports two model types:

* **Remote**: Uses cloud-based AI models
* **Local**: Uses on-device AI models

Note that some features (particularly audio features) are only available for local models.

***
