# Adding Real-Time Data Sources

After you have trained and obtained an optimal ML model, you may want to deploy it to handle prediction requests. If your training dataset has contextual features from an events data sink, you must provide a real-time data source that corresponds to the historical data source configured for that data sink. A real-time data source may be a Kafka stream or a database table with a periodic batch read schedule. Connect the real-time data source to the data sink before deploying the ML model. This ensures that your contextual features for prediction are computed on fresh real-time data.

To add a real-time data source to an events data sink, follow these steps:

1. Log in to the Aizen Jupyter console. See [Using the Aizen Jupyter Console](/docs/getting-started/using-the-aizen-jupyter-console.md).
2. Set the current working project.

   <pre data-overflow="wrap"><code>set project &#x3C;project name>
   </code></pre>
3. Configure your real-time data source by running the `configure datasource` command:

   <pre data-overflow="wrap"><code>configure datasource
   </code></pre>
4. In the notebook, you will be guided through a template form with boxes and drop-down lists that you can complete to configure the data source.
5. Add the real-time data source to the data sink using the `alter datasink` command. This command will schedule a job to periodically and continuously fetch data from the real-time data source into the data sink. Optionally, you may configure resources for the job by running the `configure resource` command. If you do not configure resources, default resource settings will be applied.

   <pre data-overflow="wrap"><code>configure resource
   alter datasink &#x3C;datasink name>
   </code></pre>
6. Check the health of your data sink by running the `status datasink` command:

   <pre data-overflow="wrap"><code>status datasink &#x3C;datasink name>
   </code></pre>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aizen-corp.gitbook.io/docs/managing-ml-workflows/adding-real-time-data-sources.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
