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

# ExecutionContext

> AID.ctx.interface.ExecutionContext

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
from AID.ctx.interface import ExecutionContext
```

Execution Context — Pipeline Orchestration & Phase Execution.

The primary API surface for executing the AIDflow pipeline.
Provides phase-based access to all workers and a unified
`process` method for sequential execution.

Executes `workers` by domain-specific pipeline phase: *data - encoding - training - selection*.

> [!NOTE]
>
> * Automated execution of all pipeline steps or a selected phase via `ctx.flow.process()`
> * Execution runs within a defined context scope (`ctx.setup`), supplied by `ProjectContext`
> * Pipeline steps are sequence-dependent - e.g., the `encoding` phase cannot be executed prior to    the `data` phase

> [!NOTE]
>
> \*\*1. data \*\*
> \
> ────────────────────
>
> 0. data\_loader
> 1. fe\_cleaner
> 2. fe\_stabilizer
> 3. obs\_stabilizer
>
> \*\*2. encoding \*\*
> \
> ────────────────────
>
> 4. num\_encoder
> 5. cat\_encoder
> 6. ixn\_encoder
> 7. woe\_encoder
> 8. woe\_stabilizer
> 9. data\_encoder
>
> \*\*3. training \*\*
> \
> ────────────────────
>
> 10. agent1\_predictor
> 11. agent2\_predictor
> 12. agent3\_predictor
> 13. agent4\_predictor
>
> \*\*4. selection \*\*
> \
> ────────────────────
>
> 14. agents\_predictor
> 15. agents\_comparator
> 16. agents\_transition
> 17. agent\_selector
> 18. champion\_predictor

#### Examples

Defining the Project Context (Control Plane) & Project Scope:

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
import aidflow as aid

ctx = aid.ProjectContext()

ctx.genesis(
    project      = 'test',
    input_data   = 'test.csv',
    target       = 'target',
    yy_mm        = 'decision_date',
    yy_mm_format = '%Y-%m-%d'
)
ctx.params()
```

Run the whole flow within the defined context:

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
ctx.flow.process('all', verbose = 0)
```

Run the whole flow within the defined context
with custom data present in memory:

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
import pandas as pd

my_data = pd.DataFrame(dict(
    target = [...], 
    decision_data = [...],
    ...
))

ctx.flow.process('all', data = my_data, verbose = 1)
```

Run selected flow phase within the defined context:

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
ctx.flow.process('data', verbose = 2)
```

Run selected single worker within the defined context:

```python theme={"theme":{"light":"dracula-soft","dark":"dracula"}}
data_loader = ctx.flow.data.data_loader()
...
ixn_encoder = ctx.flow.encoding.ixn_encoder()
...
agent2_predictor = ctx.flow.training.agent2_predictor()
...
agent_selector = ctx.flow.selection.agent_selector()
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.