# Examples directory

> Examples directory - Use sample code available in the MLOps agent tarball as a starting point for
> creating and managing deployments. Examples include model configuration, data, and scripts used to
> create deployments and run the examples.

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-04-24T16:03:56.564958+00:00` (UTC).

## Primary page

- [Examples directory](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/monitoring-agent/agent-ex.html): Full documentation for this topic (HTML).

## Sections on this page

- [Run code examples with Python](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/monitoring-agent/agent-ex.html#run-code-examples-with-python): In-page section heading.

## Related documentation

- [Classic UI documentation](https://docs.datarobot.com/en/docs/classic-ui/index.html): Linked from this page.
- [MLOps](https://docs.datarobot.com/en/docs/classic-ui/mlops/index.html): Linked from this page.
- [Deployment](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/index.html): Linked from this page.
- [MLOps agents](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/index.html): Linked from this page.
- [Monitoring agent](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/monitoring-agent/index.html): Linked from this page.
- [MLOps Command Line Interface (mlops-cli)](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/monitoring-agent/agent-use.html#monitor-using-the-mlops-cli): Linked from this page.

## Documentation content

# Examples directory

The `examples` directory in the MLOps agent tarball contains both sample code (snippets for manual inspection) and example code (self-contained examples that you can run) in Python and Java. Navigate to the subdirectory for the language you wish to use and reference the respective `README` for further instruction.

The examples directory includes model configuration, data, and scripts used to create deployments and run the examples, using Python to create the model package and deployment programmatically. Therefore, you must install the Python version of the MLOps library (described below). These examples also use the [MLOps Command Line Interface (mlops-cli)](https://docs.datarobot.com/en/docs/classic-ui/mlops/deployment/mlops-agent/monitoring-agent/agent-use.html#monitor-using-the-mlops-cli) to set up deployments and perform deployment actions. You must provide the `MLOPS_SERVICE_URL` and `MLOPS_API_TOKEN` environment variables to use the `mlops-cli`. In addition, most examples use the `mlops-cli` to upload monitoring data for faster setup; however, while the `mlops-cli` tool is suitable for simple use cases, you should use the agent for production scenarios.

## Run code examples with Python

To run the Python code examples, you must install the dependencies used by the examples:

```
pip install -r examples/python/requirements.txt
```

See the `README` file in each example directory for further example-specific configuration requirements. In general, to run an example:

1. Initialize the model package and deployment: ./create_deployment.sh
2. Generate predictions and report statistics to DataRobot: ./run_example.sh
3. Verify that metrics were sent successfully: ./verify_example.sh
4. Delete resources created in the example: ./cleanup.sh
