---
title: rpk ai policy format
latest-operator-version: v26.2.6
latest-console-tag: v3.14.0
latest-connect-version: 4.118.0
latest-redpanda-tag: v26.2.7
docname: rpk/rpk-ai/rpk-ai-policy-format
page-component-name: agentic-data-plane
page-version: master
page-component-version: master
page-component-title: Agentic Data Plane
page-relative-src-path: rpk/rpk-ai/rpk-ai-policy-format.adoc
page-edit-url: https://github.com/redpanda-data/adp-docs/edit/main/modules/reference/pages/rpk/rpk-ai/rpk-ai-policy-format.adoc
description: Format a draft using PermissionService, preserving comments. Requires an environment and authentication.
page-git-created-date: "2026-10-26"
page-git-modified-date: "2026-10-26"
page-generated-sources:
  - include: streaming:reference:partial$rpk-ai/rpk-ai-policy-format.adoc
    generator: rpk-docs
    version: null
    source: the rpk command help in redpanda-data/streaming-enterprise
page-generated-content: partial
---

# rpk ai policy format

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [agentic-data-plane-full.txt](https://docs.redpanda.com/agentic-data-plane-full.txt)

<!-- Source: https://docs.redpanda.com/agentic-data-plane/reference/rpk/rpk-ai/rpk-ai-policy-format.md -->

Format a draft using PermissionService, preserving comments. Requires an environment and authentication. Source is limited to 64 KiB of UTF-8. Default output is formatted Cedar on stdout; JSON/YAML/markdown output includes the full result and schema version. Invalid syntax fails without writing formatted source. Schema validation findings in the result do not prevent formatting; use analyze to require valid schema usage. Input files and stored policies are never modified. Redirect to a different file, not the input file.

> 📝 **NOTE**
>
> This command was introduced in ai version 0.2.94.

## Usage

```bash
rpk ai policy format [flags]
```

## Examples

This section provides examples of how to use `rpk ai policy format`.

```bash
rpk ai policy format --cedar-file draft.cedar > formatted.cedar
cat draft.cedar | rpk ai policy format --cedar-file=-
rpk ai policy format --cedar-file draft.cedar -o json
```

## Flags

| Value | Type | Description |
| --- | --- | --- |
| `--cedar` | string | inline Cedar policy text. Mutually exclusive with `--cedar-file`. |
| `--cedar-file` | string | Cedar input file, or - for stdin. Never overwritten. Mutually exclusive with `--cedar`. |

## Global flags

| Value | Type | Description |
| --- | --- | --- |
| `--config` | string | Redpanda or `rpk` config file; default search paths are `~/.config/rpk/rpk.yaml`, `$PWD/redpanda.yaml`, and `/etc/redpanda/redpanda.yaml`. |
| `-X, --config-opt` | stringArray | Override `rpk` configuration settings; `-X help` for detail or `-X list` for terser detail. |
| `--ignore-profile` | bool | Ignore `rpk.yaml` and `redpanda.yaml`; use default settings. |
| `--profile` | string | `rpk` profile to use. |
| `-v, --verbose` | bool | Enable verbose logging. |