# Configure the Python agent

The standard configuration for all agents uses this order of precedence.

Additionally, you must configure middleware and configure the Python agent with a YAML configuration file.

## Contrast Service Configuration (before version 5.19.0 only)

In earlier versions (before version 5.19.0), the Python agent launches an executable on startup that also needs access to the configuration files. Since the service is generally launched by the Python agent process, it has access to the same configuration file as the agent. However, if the service is started independently, it will attempt to use the same order of precedence for its configuration file.

In other words, the service can share the application's configuration file, if (as is usually the case) the service's working directory is also the base directory of the application. Both the agent and the service use the  /etc/contrast/contrast_security.yaml path.

### Tip

Use the Contrast agent configuration editor to create or upload a YAML configuration file, validate YAML, and get setting recommendations.

## Python YAML template

Use this template to configure the Python agent using a YAML configuration file. (Learn more about YAML configuration.)

Place your YAML file in the default location: /etc/contrast/contrast_security.yaml

https://docs.contrastsecurity.com/common-agent-config/python_contrast_security.yaml