For the complete documentation index, see [llms.txt](https://docs.pandium.com/llms.txt). This page is also available as [Markdown](https://docs.pandium.com/getting-started/anatomy-of-an-integration/environment-variables/stdout.md).

The last thing written to the stdout file descriptor during a run is passed to the next run. Typically, this is used to pass state between runs using a JSON encoded string of an object that includes, for example, a list of IDs of resources that have already been processed or a timestamp of the most recently processed resource. The string passed to stdout is also used to power the data behind a [dynamic config](https://docs.pandium.com/getting-started/anatomy-of-an-integration/pandium.yaml-spec/dynamic-configurations).

### Context Variables

Below is a list of variables that are injected into the run environment with the `PAN_CTX` prefix.

| name                                   | description                                                                                     | notes                                    |
|----------------------------------------|-------------------------------------------------------------------------------------------------|------------------------------------------|
| **PAN_CTX_INTEGRATION_ID**            | The Pandium ID of the Integration that is running currently.                                   | an integer unique to your account       |
| **PAN_CTX_INTEGRATION_NAME**          | The name of the Integration that is running currently                                          |                                          |
| **PAN_CTX_TENANT_ID**                 | The Pandium ID of the Tenant that is running currently.                                       | An integer unique to your account       |
| **PAN_CTX_TENANT_NAME**               | The name of the Tenant that is running currently.                                             |                                          |
| **PAN_CTX_RUN_MODE**                  | An enum of one of the following values: `init`, `normal`, `webhook`                            |                                          |
| **PAN_CTX_RUN_TRIGGERS**              | List of objects that contain the payload data for run triggers                                 | Can view the mode, source, and payload data as well as headers it was sent with |
| **PAN_CTX_ENV**                       | The environment the sync is running in, i.e. dev/staging/prod                                 |                                          |
| **PAN_CTX_LAST_RUN_START_TIME**      | A datetime that represents the time the last run started. i.e. `2021-07-24 20:04:21 +0000 UTC`| Will appear in environment only after first run. |
| **PAN_CTX_LAST_RUN_COMPLETION_TIME** | A datetime that represents the time the last run completed. i.e. `2021-07-24 20:07:21 +0000 UTC`| Will appear in environment only after first run. |
| **PAN_CTX_LAST_RUN_PHASE**            | An enum of one of the following values: `Succeeded`, `Failed (Platform Issue)`, `Failed (Integration Issue)`, `Failed (Timeout)`| Will appear in environment only after first run. |
| **PAN_CTX_LAST_RUN_STD_OUT**          | The JSON encoded string that was optionally printed to _stdout_ during last Run.              |                                          |
| **PAN_CTX_LAST_SUCCESSFUL_RUN_START_TIME**| A datetime that represents the time the last successful run. i.e. `2021-07-24 20:04:21 +0000 UTC`| Will appear in environment only after _successful_ first run. |
| **PAN_CTX_LAST_SUCCESSFUL_RUN_COMPLETION_TIME**| A datetime that represents the time the last successful run completed. i.e. `2021-07-24 20:07:21 +0000 UTC`| Will appear in environment only after _successful_ first run. |
| **PAN_CTX_LAST_SUCCESSFUL_RUN_PHASE** | An enum of one of the following values: `Succeeded`, `Failed (Platform Issue)`, `Failed (Integration Issue)`, `Failed (Timeout)`| Will appear in environment only after _successful_ first run. |
| **PAN_CTX_LAST_SUCCESSFUL_RUN_STD_OUT**| The JSON encoded string that was optionally printed to _stdout_ during last successful Run.    | A good way to use the saved state between runs via stdout is to continue running large syncs sequentially in a 'dynamic sync' process. |

#### Examples of writing to stdout in various languages

```csharp
Console.WriteLine("Hello World")
```
```java
System.out.println("Hello World!");
```
```javascript
console.log('Hello World')
```
```php
echo "Hello World" . "\n"
```
```python
print("Hello World!")
```
```ruby
puts "Hello Word!"
```

Please Note: When handling context/stdout, there is a 128kb limit that is supported within Pandium.
