> For the complete documentation index, see [llms.txt](https://cortex-docs.paloaltonetworks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cortex-docs.paloaltonetworks.com/cortex-xdr-5.x/protect-your-endpoints/install-and-manage-endpoints/set-up-endpoint-protection/create-an-agent-installation-package.md).

# Create an agent installation package

To install the Cortex XDR agent on the endpoint for the first time, create an agent installation package. Review [Where can I install the Cortex XDR agent](/compatibility-matrix/where-can-i-install-the-cortex-xdr-agent.md) for supported versions and operating systems.

To install the Cortex XDR agent software, you must use a valid installation package that exists in your Cortex XDR management console. If you delete an installation package, new agents installed from this package are not able to register to Cortex XDR, however, existing agents may re-register using the Agent ID generated by the installation package.

1. From Cortex XDR, select **Inventory** → **Endpoints** → **Agent Installations**.
2. Click **Create** to create a new installer.
3. Select the **Package Type**:
   * **Standalone**: Use for fresh installations and to upgrade agents on a registered endpoint that is connected to Cortex XDR.
   * (Linux only) **Kubernetes**: Use for fresh installations and upgrades of Cortex XDR agents running on Kubernetes clusters.
   * **Helm**: Use this package for fresh installations and upgrades of Cortex XDR agents running on Kubernetes clusters. [#guidelines-for-kubernetes-installer](#guidelines-for-kubernetes-installer "mention")
   * **CaaS**: Create the Cortex XDR container-embedded agent Dockerfile. For installer instructions see [CaaS Workloads](/cortex-xdr-5.x/protect-your-endpoints/endpoint-protection/caas-workloads.md).
   * **Amazon ECS EC2:** Create an installation package to deploy the agent on Amazon ECS clusters with EC2 launch types.
   * **Serverless function**: Create an installation package for serverless function to deploy to your runtime platform. [#guidelines-for-serverless-installer](#guidelines-for-serverless-installer "mention")

<details>

<summary>Guidelines for Kubernetes installer</summary>

* Settings for the Kubernetes installer cannot be changed after you create the installation package.
* For Version, select the desired Cortex XDR agent version.

  If the option Always deploy the latest agent version is displayed, do not select it.
* For the Agent Daemonset Namespace, it is recommended to use the default cortex-xdr namespace.
* For a more granular deployment, enter any labels or selectors in the Node Selector. The Cortex XDR agent will be deployed only on these nodes.
* To configure the Cortex XDR agent to communicate through a proxy, enter either the IP address and port number or enter the FQDN and port number. When you enter the FQDN, you can use both lowercase and uppercase letters. Avoid using special characters or spaces. Use commas to separate multiple addresses.<br>

</details>

<details>

<summary>Guidelines for serverless installer</summary>

**How to create an agent package for serverless function:**

1. From Cortex XDR, go to Inventory+Endpoints+Installations and click Create.
2. Add name, description and add any endpoint tags that will be added to the agent as part of the installation process.
3. For Package Type, select Serverless Function.
4. Configure the following settings for Serverless Function:

   1. For Version, select the required Cortex agent version.
   2. For Cloud Provider, AWS is configured for this release.
   3. For Runtime, select one of the environments:
      * node.js
      * python
   4. For Deployment Type, select the type:
      * Embedded
      * AWS Layers
   5. If node.js and the deployment type, AWS Layers are selected, select one of the Modules:
      * ECMAScript
      * CommonJS
   6. For Embed Default Profile From, select from the profile rules configured for serverless functions.

   The profile will be applied if the security policy cannot be retrieved in real-time.

The package is created and ready to be deployed.

**How to deploy the package to your runtime environment:**

1. From Cortex XDR, go to Inventory+Endpoints+Installations and from the Agent Installations page, right click and select View Installation Instructions.
2. Depending on the runtime environment, the instructions are slightly different.
   * Agent installation package for embedded python:
     1. Download the serverless agent bundle.
     2. Log in to your AWS Management Console.
     3. Navigate to the AWS Lambda service, and unzip the serverless agent bundle in the main folder.
     4. Add the serverless agent to the function by importing the Cortex library and wrapping the function’s handler.

        The Cortex serverless library must be imported after other libraries to activate the hooks that enable auditing.
   * Agent installation package for embedded node.js:
     1. Download the serverless agent bundle.
     2. Log in to your AWS Management Console.
     3. Navigate to the AWS Lambda service, and unzip the serverless agent bundle in the main folder.
     4. Add the serverless agent to the function by importing the Cortex library and wrapping the function’s handler.
   * Agent installation package for node.js using AWS Layers in ECMAScript (JavaScript) runtime/Agent installation package for node.js in AWS Lambda using AWS Layers with CommonJS module format:
     1. Download the serverless agent bundle.
     2. Log in to your AWS Management Console.
     3. Navigate to the AWS Lambda service, and upload the layer and add it to the function’s configuration.
     4. Save the current Lamba handler setting in the ORIGINAL\_HANDLER environment variable.
     5. Change the Lambda handler setting to cortex.handler.
   * Agent installation package for python using AWS Layers in python runtime/Agent installation package for python in AWS Lambda using AWS Layers with python module format:
     1. Download the serverless agent bundle.
     2. Log in to your AWS Management Console.
     3. Create a new AWS layer with the downloaded bundle, copy the new layer ARN value, and add the new layer using the copied ARN.
     4. Save the current Lamba handler setting in the ORIGINAL\_HANDLER environment variable.
     5. Change the Lambda handler setting to cortex.handler.

</details>

4. In Parameters, enter a unique name and an optional description to identify the installation package.

   The package name can contain letters, numbers, hyphens, underscores, commas, and spaces, and should not exceed 100 characters.
5. In Metadata define the appropriate settings for the package type, and then click Create.
6. Download your installation package.

   When the status of the package shows `Completed`, right-click the package, and click Download.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://cortex-docs.paloaltonetworks.com/cortex-xdr-5.x/protect-your-endpoints/install-and-manage-endpoints/set-up-endpoint-protection/create-an-agent-installation-package.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
