---
schema_version: "1"
id: 72422ffbd7e8dd9bad6bef068280bb90cbd88f53cd62aae9a6315d345c54c08d
title: A2A v1 Prompt Decorator Policy
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/gateway/1.13/policies-included-a2a-v1-prompt-decorator.md
canonical_url: https://docs.mulesoft.com/gateway/1.13/policies-included-a2a-v1-prompt-decorator
source_site: docs.mulesoft.com
content_type: documentation
content_hash: df2167b4e1240f22224f5c3940df94f53708d0360621dc26d9301721982205d9
description: MuleSoft Documentation Site
release: "1.13"
latest: false
---
---
product: Omni Gateway
version: 1.13
keywords: api gateway, flex gateway, gateway, policy
---

# A2A v1 Prompt Decorator Policy

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

<table><colgroup><col> <col></colgroup><tbody><tr><td><p><strong>Policy Name</strong></p></td><td><p>A2A v1 Prompt Decorator</p></td></tr><tr><td><p><strong>Summary</strong></p></td><td><p>Decorates A2A v1 prompts with additional context information</p></td></tr><tr><td><p><strong>Category</strong></p></td><td><p>A2A</p></td></tr><tr><td><p><strong>First Omni Gateway version available</strong></p></td><td><p>v1.13.0</p></td></tr><tr><td><p><strong>Release Notes</strong></p></td><td><p><a href="https://docs.mulesoft.com/release-notes/gateway/policies/a2a-v1-prompt-decorator-release-notes">A2A v1 Prompt Decorator Policy</a></p></td></tr><tr><td><p><strong>Returned Status Codes</strong></p></td><td><p>No return codes exist for this policy.</p></td></tr></tbody></table>

> [!NOTE] This policy supports Agent2Agent Protocol (A2A) version v0.3.0. To learn more about A2A
> versions, see [A2A Releases](https://github.com/a2aproject/A2A/releases).

## Summary

The A2A v1 Prompt Decorator policy injects additional content into agent prompts before they’re sent
to the upstream agent. This policy supports A2A v1.0 `SendMessage` and `SendStreamingMessage`
requests across all transport protocols: JSON-RPC, HTTP+JSON, and gRPC.

You can decorate prompts with either text content or file references. Text decorators add plain text
to the beginning of the message, while file decorators add external resources via URL or inline
base64-encoded content. All decorators support conditional evaluation using DataWeave expressions,
enabling you to control when specific decorations are applied based on request attributes,
authentication context, or message parameters.

The policy injects content to the beginning of the user message’s `parts[]` array before the request
reaches the upstream agent, ensuring the additional context appears before the user’s original
message. The A2A v1 Prompt Decorator policy decorates A2A v1 prompts with additional context
information. You can add text instructions or file references (via URL or base64-encoded content) to
the beginning of messages before they reach the upstream agent. This policy supports A2A v1.0
traffic across all transport protocols: JSON-RPC, HTTP+JSON, and gRPC.

> [!NOTE] This policy supports A2A v1.0 traffic only. For pre-v1.0 A2A traffic, use the
> [A2A Prompt Decorator Policy](https://docs.mulesoft.com/gateway/1.13/policies-included-a2a-prompt-decorator).

## Configuring Policy Parameters

### Omni Gateway Local Mode

The A2A v1 Prompt Decorator policy isn’t supported in Local Mode.

### Managed Omni Gateway and Omni Gateway Connected Mode

When you apply the policy from the UI, the following parameters are displayed:

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Element</th><th>Description</th><th>Required</th><th>Default</th></tr></thead><tbody><tr><td><div><div><p>Text Decorators</p></div></div></td><td><div><div><p>Array of text decorations to add to prompts. Each decorator can include a text expression and an optional condition.</p></div><div><p>For more information, see <a href="#text-decorators">Text Decorators</a>.</p></div></div></td><td><div><div><p>No</p></div></div></td><td><div><div><p>Empty array</p></div></div></td></tr><tr><td><div><div><p>File Decorators</p></div></div></td><td><div><div><p>Array of file-type decorations to add to prompts. Each decorator specifies file content (URL or base64), file type, and optional metadata like filename and MIME type.</p></div><div><p>For more information, see <a href="#file-decorators">File Decorators</a>.</p></div></div></td><td><div><div><p>No</p></div></div></td><td><div><div><p>Empty array</p></div></div></td></tr></tbody></table>

### Text Decorators

Text decorators add plain text content to the beginning of the message. Each text decorator has the
following properties:

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Description</th><th>Required</th><th>Default</th></tr></thead><tbody><tr><td><div><div><p>Prompt Text</p></div></div></td><td><div><div><p>DataWeave expression that generates the prompt text injected into the request. The result is added as a text part with media type <code>text/plain</code>.</p></div><div><p>The expression can access:</p></div><div><ul><li><p><code>attributes</code>: Request attributes (headers, query parameters, etc.)</p></li><li><p><code>authentication</code>: Authentication context from upstream authentication policies</p></li><li><p><code>vars.params</code>: The <code>SendMessageParams</code> object containing the message and conversation ID</p></li></ul></div><div><p>For example: <code>#['Use imperial metric units']</code></p></div></div></td><td><div><div><p>Yes</p></div></div></td><td><div><div><p>None</p></div></div></td></tr><tr><td><div><div><p>Condition</p></div></div></td><td><div><div><p>Optional DataWeave expression that filters which prompts to decorate. If the expression evaluates to <code>true</code>, the decorator is applied; otherwise, it is skipped.</p></div><div><p>For example: <code>#[attributes.headers['x-environment']=='production']</code></p></div></div></td><td><div><div><p>No</p></div></div></td><td><div><div><p>Always applied</p></div></div></td></tr></tbody></table>

### File Decorators

File decorators add file references or inline file content to the beginning of the message. Each
file decorator has the following properties:

<table><colgroup><col> <col> <col> <col></colgroup><thead><tr><th>Property</th><th>Description</th><th>Required</th><th>Default</th></tr></thead><tbody><tr><td><div><div><p>Content</p></div></div></td><td><div><div><p>DataWeave expression containing either a URL to an external file (when <strong>File Source</strong> is <code>Uri</code>) or base64-encoded file content (when <strong>File Source</strong> is <code>Base64</code>).</p></div><div><p>The expression can access <code>attributes</code>, <code>authentication</code>, and <code>vars.params</code>.</p></div><div><p>Base64 content is validated against the pattern <code>^[A-Za-z0-9+/]*={0,2}$</code>. Invalid content causes the decorator to be skipped with a warning logged.</p></div><div><p>For example, URI: <code>#['https://example.com/schema.json']</code></p></div><div><p>For example, Base64: <code>#['QmFzZTY0IGVuY29kZWQgZmlsZSBjb250ZW50']</code></p></div></div></td><td><div><div><p>Yes</p></div></div></td><td><div><div><p>None</p></div></div></td></tr><tr><td><div><div><p>File Source</p></div></div></td><td><div><div><p>Specifies whether the Content field contains a URL or base64-encoded data. Supported values:</p></div><div><ul><li><p><code>Uri</code>: Content is a URL to an external file</p></li><li><p><code>Base64</code>: Content is base64-encoded file data</p></li></ul></div></div></td><td><div><div><p>Yes</p></div></div></td><td><div><div><p><code>Base64</code></p></div></div></td></tr><tr><td><div><div><p>File Name</p></div></div></td><td><div><div><p>Optional DataWeave expression that generates the filename for the injected file part.</p></div><div><p>For example: <code>#['api-schema.json']</code></p></div></div></td><td><div><div><p>No</p></div></div></td><td><div><div><p>None</p></div></div></td></tr><tr><td><div><div><p>File Mime Type</p></div></div></td><td><div><div><p>Optional DataWeave expression that generates the MIME type for the injected file part.</p></div><div><p>If not specified, defaults to <code>application/octet-stream</code>.</p></div><div><p>For example: <code>#['application/json']</code></p></div></div></td><td><div><div><p>No</p></div></div></td><td><div><div><p><code>application/octet-stream</code></p></div></div></td></tr><tr><td><div><div><p>Condition</p></div></div></td><td><div><div><p>Optional DataWeave expression that filters which prompts to decorate. If the expression evaluates to <code>true</code>, the decorator is applied; otherwise, it is skipped.</p></div><div><p>For example: <code>#[attributes.headers['x-include-schema']=='true']</code></p></div></div></td><td><div><div><p>No</p></div></div></td><td><div><div><p>Always applied</p></div></div></td></tr></tbody></table>

## Examples

### Text Decoration

This example adds a text instruction to all prompts, directing the agent to use Imperial units:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: PolicyBinding
metadata:
  name: a2a-v1-prompt-decorator-text
spec:
  targetRef:
    kind: ApiInstance
    name: my-a2a-v1-agent
  policyRef:
    name: a-two-a-v1-prompt-decorator-flex
  config:
    textDecorators:
      - text: "#['Use Imperial metric units for all measurements.']"
```

### Conditional Text Decoration

This example adds different text decorations based on the request environment header:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: PolicyBinding
metadata:
  name: a2a-v1-prompt-decorator-conditional
spec:
  targetRef:
    kind: ApiInstance
    name: my-a2a-v1-agent
  policyRef:
    name: a-two-a-v1-prompt-decorator-flex
  config:
    textDecorators:
      - text: "#['You are operating in PRODUCTION mode. Be extra careful.']"
        condition: "#[attributes.headers['x-environment']=='production']"
      - text: "#['You are operating in TEST mode. Feel free to experiment.']"
        condition: "#[attributes.headers['x-environment']=='test']"
```

### File Decoration with URI

This example adds an external schema file to all prompts:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: PolicyBinding
metadata:
  name: a2a-v1-prompt-decorator-file-uri
spec:
  targetRef:
    kind: ApiInstance
    name: my-a2a-v1-agent
  policyRef:
    name: a-two-a-v1-prompt-decorator-flex
  config:
    fileDecorators:
      - file: "#['https://example.com/api-schema.json']"
        fileType: Uri
        fileName: "#['api-schema.json']"
        fileMimeType: "#['application/json']"
```

### File Decoration with Base64 Content

This example adds inline base64-encoded content as a file:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: PolicyBinding
metadata:
  name: a2a-v1-prompt-decorator-file-base64
spec:
  targetRef:
    kind: ApiInstance
    name: my-a2a-v1-agent
  policyRef:
    name: a-two-a-v1-prompt-decorator-flex
  config:
    fileDecorators:
      - file: "#['SGVsbG8sIFdvcmxkIQ==']"
        fileType: Base64
        fileName: "#['greeting.txt']"
        fileMimeType: "#['text/plain']"
```

### Combined Text and File Decorations

The following example combines both text and file decorations:

```yaml
apiVersion: gateway.mulesoft.com/v1alpha1
kind: PolicyBinding
metadata:
  name: a2a-v1-prompt-decorator-combined
spec:
  targetRef:
    kind: ApiInstance
    name: my-a2a-v1-agent
  policyRef:
    name: a-two-a-v1-prompt-decorator-flex
  config:
    textDecorators:
      - text: "#['Use Imperial metric units.']"
      - text: "#['Follow the API schema provided in the attached file.']"
    fileDecorators:
      - file: "#['https://example.com/schema.json']"
        fileType: Uri
        fileName: "#['api-schema.json']"
        fileMimeType: "#['application/json']"
```
