﻿---
title: stack kb elastic-agent-policies post-fleet-agent-policies cli command
description: Create an agent policy Behaviour flags: --dry-run — validate all inputs and exit without performing any action 
url: https://www.elastic.co/elastic/docs-builder/docs/4083/reference/elastic-cli/cli/stack/kb/elastic-agent-policies/post-fleet-agent-policies
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# stack kb elastic-agent-policies post-fleet-agent-policies cli command
<cli-modifiers>
</cli-modifiers>

```bash
elastic stack kb elastic-agent-policies post-fleet-agent-policies \
  --name <name> \
  --namespace <namespace> \
  [options]
```

Create an agent policy
**Behaviour flags:**
`--dry-run` — validate all inputs and exit without performing any action

## Options

<definitions>
  <definition term="--name string required">
  </definition>
  <definition term="--namespace string required">
  </definition>
  <definition term="--sys-monitoring">
    Whether to add the system integration to the new agent policy
  </definition>
  <definition term="--advanced-settings string">
  </definition>
  <definition term="--agent-features string[]">
    **Repeatable:** pass `--agent-features` multiple times to supply more than one value
  </definition>
  <definition term="--agentless string">
  </definition>
  <definition term="--data-output-id string">
  </definition>
  <definition term="--description string">
  </definition>
  <definition term="--download-source-id string">
  </definition>
  <definition term="--fleet-server-host-id string">
  </definition>
  <definition term="--force">
  </definition>
  <definition term="--global-data-tags string[]">
    User defined data tags that are added to all of the inputs. The values can be strings or numbers.
    **Repeatable:** pass `--global-data-tags` multiple times to supply more than one value
  </definition>
  <definition term="--has-agent-version-conditions">
  </definition>
  <definition term="--has-fleet-server">
  </definition>
  <definition term="--id string">
  </definition>
  <definition term="--inactivity-timeout number">
  </definition>
  <definition term="--is-default">
  </definition>
  <definition term="--is-default-fleet-server">
  </definition>
  <definition term="--is-managed">
  </definition>
  <definition term="--is-protected">
  </definition>
  <definition term="--is-verifier">
  </definition>
  <definition term="--keep-monitoring-alive">
    When set to true, monitoring will be enabled but logs/metrics collection will be disabled
  </definition>
  <definition term="--min-agent-version string">
  </definition>
  <definition term="--monitoring-diagnostics string">
  </definition>
  <definition term="--monitoring-enabled string[]">
    **Repeatable:** pass `--monitoring-enabled` multiple times to supply more than one value
  </definition>
  <definition term="--monitoring-http string">
  </definition>
  <definition term="--monitoring-output-id string">
  </definition>
  <definition term="--monitoring-pprof-enabled">
  </definition>
  <definition term="--overrides string">
    Override settings that are defined in the agent policy. Input settings cannot be overridden. The override option should be used only in unusual circumstances and not as a routine procedure.
  </definition>
  <definition term="--package-agent-version-conditions string[]">
    **Repeatable:** pass `--package-agent-version-conditions` multiple times to supply more than one value
  </definition>
  <definition term="--required-versions string[]">
    **Repeatable:** pass `--required-versions` multiple times to supply more than one value
  </definition>
  <definition term="--space-ids string[]">
    **Repeatable:** pass `--space-ids` multiple times to supply more than one value
  </definition>
  <definition term="--supports-agentless">
    Indicates whether the agent policy supports agentless integrations. Deprecated in favor of the Fleet managed integrations API.
  </definition>
  <definition term="--unenroll-timeout number">
  </definition>
  <definition term="--input-file string">
    path to a JSON file to use as command input
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>