# Understand property.json

This file contains the orchestration of extensions. It is the main runtime configuration file.

<figure><img src="https://2002915447-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsowiBnPeLGQTihObiNCX%2Fuploads%2FS4va5Peq04g0nPNaZHJb%2Fimage4.png?alt=media&#x26;token=4df79191-f9db-445e-ab80-f47c7071a9b9" alt=""><figcaption><p>Overview of Graph</p></figcaption></figure>

The `property.json` file contains the following orchestration information:

* Graphs
* Nodes
* Connections

## Graph

The `predefined_graphs` property comprises a collection of available graphs, each specifying the agent's behavior in a particular scenario. Every graph is uniquely identified by its `name` property, allowing precise selection and reference.

Each graph is structured with `nodes` and `connections` properties, defining its components and the interactions between them.

## Nodes

The `predefined_graphs` property encapsulates a set of predefined graphs, each outlining the agent's behavior for a specific scenario. Each graph is distinguished by a unique `name` property, enabling clear identification and selection.

Graphs are composed of two key elements: `nodes`, representing individual components, and `connections`, which define the relationships and interactions between these components.

**Node Property**\
\
The `property` section within a node encapsulates the configuration settings specific to the associated extension. These properties are tailored to the extension and are detailed in the `manifest.json` file located within the corresponding extension folder. Developers can define runtime properties to customize the extension's behavior according to their needs.

Below is an example demonstrating the configuration of the `chatgpt_openai_python` extension:

```
{
  "name": "chatgpt_openai_python",
  "addon": "chatgpt_openai_python",
  "property": {
    "api_key": "${env:OPENAI_API_KEY|}",
    "model": "gpt-3.5-turbo",
    "temperature": 0.5,
    "max_tokens": 100,
    "prompt": "You are a helpful assistant"
  }
}
```

<figure><img src="https://2002915447-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsowiBnPeLGQTihObiNCX%2Fuploads%2FRo9TnS2end51z24pX4sT%2Fimage5.png?alt=media&#x26;token=840e7b18-3a34-4a30-9a99-a577860bb291" alt=""><figcaption><p>Property JSON nodes</p></figcaption></figure>

**Read environment variables**

It is common for extensions to require an `api_key` for proper functionality. To avoid hardcoding sensitive values like the `api_key` directly in the `property.json` file, environment variables can be utilized. The syntax `${env:<env_var_name>|<default_value>}` allows dynamic retrieval of environment variables, with the option to specify a fallback default value.

Below is an example demonstrating how to retrieve the `OPENAI_API_KEY` environment variable:

```
{
  "name": "chatgpt_openai_python",
  "addon": "chatgpt_openai_python",
  "property": {
    "api_key": "${env:OPENAI_API_KEY|}"
  }
}
```

## Connections

The `connections` section defines the links between nodes, specifying both the source and destination nodes. Each connection is characterized by its `extension_group` and `extension` properties, which identify the source node and determine the supported multimodal data protocols (e.g., `audio_frame`, `video_frame`, `data`, `cmd`) enabled by the Nyra Framework.

For each data protocol, the connection includes a list of destination definitions. Each destination definition contains:

* A `name` property, representing the key for the property data.
* A `dest` property, specifying a list of target nodes.

Below is an example illustrating how to establish a connection between two nodes:

```
{
  "extension_group": "default",
  "extension": "agora_rtc",
  "audio_frame": [
    {
      "name": "pcm_frame",
      "dest": [{
        "extension_group": "default",
        "extension": "deepgram_asr"
      }]
    }
  ]
}
```

<figure><img src="https://2002915447-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsowiBnPeLGQTihObiNCX%2Fuploads%2FQnIVAMdxFWckO97MBM4Z%2Fimage6.png?alt=media&#x26;token=42f429fa-fbf5-42b6-b080-cb10bd2bc3a4" alt=""><figcaption><p>Property JSON Connections</p></figcaption></figure>

In the example above, the `agora_rtc` extension is connected to the `deepgram_asr` extension, where the `agora_rtc` extension transmits `pcm_frame` data to the `deepgram_asr` extension.
