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

# DAGWorks Tracking Adapter

> Instructions on how to use the DAGWorks Tracking Adapter.

## DAGWorks Tracking Adapter

Connecting with the Hosted Hamilton UI on DAGWorks takes the form of an adapter that forms a plug-in addition to the Hamilton Driver.
The Hamilton driver accepts adapters, so adding in DAGWorks, allows you to run your Hamilton dataflows as usual, while also
logging/tracking them with DAGWorks.

You can import the adapter as follows:

```python theme={null}
import os
from dagworks import adapters
from hamilton import driver
```

And instantiate it:

```python theme={null}
import my_module_1, my_module_2

 dw_tracking_adapter = adapters.DAGWorksTracker(
    project_id=32, # Replace with your project ID
    api_key=os.environ["DW_API_KEY"], # Securely load your API key
    username="elijah@dagworks.io", # replace with your email
    dag_name="LTV_Model", # replace with your DAG name
    # replace with whatever metadata you want stored with your run/project version
    tags={"env" : "staging", "region" : "US"},
)

driver = (
  driver.Builder()
     .with_config({"config_item_1" : "config_value_1", "config_item_2" : "config_value_2"})
     .with_modules(my_module_1, my_module_2) # python modules with Hamilton functions
     .with_adapters(dw_tracking_adapter) # DAGWorks tracking adapter
     .build()
)
```

The DAGWorksTracker accepts DAGWorks-specific arguments (all keyword-only):

<AccordionGroup>
  <Accordion title={<code>project_id</code>}>
    `int` Project ID from the UI. Project must already be created.

    ```python theme={null}
    project_id=32 
    ```

    Keyword-only argument.
  </Accordion>

  <Accordion title={<code>api_key</code>}>
    `str` API key from the UI.

    ```python theme={null}
    api_key=os.env["DW_API_KEY"] 
    ```

    Keyword-only argument.
  </Accordion>

  <Accordion title={<code>username</code>}>
    `str` Login from the API -- full email.

    ```python theme={null}
    username="elijah@dagworks.io"
    ```

    Keyword-only argument.
  </Accordion>

  <Accordion title={<code>dag_name</code>}>
    `str` Name corresponding to the project version. See [data model](/capabilities#dagworks-data-model) for more details on how this is used.

    ```python theme={null}
    dag_name="staging"
    ```

    Keyword-only argument.
  </Accordion>

  <Accordion title={<code>tags</code>}>
    `Dict[str, str]` Tags for locating in the UI/metadata that you can use to store information and filter runs/versions.

    ```python theme={null}
    tags={"env" : "staging", "region" : "US"}
    ```

    Keyword-only argument.
  </Accordion>
</AccordionGroup>
