> This page is for SWML.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

# amazon_bedrock

> Create an Amazon Bedrock agent interaction.

[params]: /docs/swml/reference/calling/amazon-bedrock/params

[prompt]: /docs/swml/reference/calling/amazon-bedrock/prompt

[SWAIG]: /docs/swml/reference/calling/amazon-bedrock/swaig

[set_global_data action]: /docs/swml/reference/calling/amazon-bedrock/swaig/functions/data-map#actions

[prompt-engineering]: /docs/platform/ai/prompt-engineering

Create an Amazon Bedrock agent with a prompt. Since the text prompt is central to getting great results out of the AI,
it is highly recommended that you also read the [prompt engineering][prompt-engineering] guide.

## **Properties**

**`amazon_bedrock`** `object` — required

An object that accepts the following properties.

---

**`amazon_bedrock.global_data`** `object`

A powerful and flexible environmental variable which can accept arbitrary data that is set initially in the SWML script or from the SWML [`set_global_data` action][set_global_data action]. This data can be referenced **globally**. All contained information can be accessed and expanded within the prompt - for example, by using a template string.

---

**`amazon_bedrock.params`** `object`

A JSON object containing [`parameters`][params] as key-value pairs.

---

**`amazon_bedrock.post_prompt`** `object`

The final set of instructions and configuration settings to send to the agent.
Accepts either a `text` string or a `pom` object array for structured prompts, plus optional tuning parameters.
See [post\_prompt details](#post_prompt) below.

---

**`amazon_bedrock.post_prompt_url`** `string`

The URL to which to send status callbacks and reports. Authentication can also be set in the url in the format of `username:password@url`.
See [post\_prompt\_url callback](#post_prompt_url-callback) below.

---

**`amazon_bedrock.prompt`** `object` — required

Establishes the initial set of instructions and settings to configure the agent.

See [`prompt`][prompt] for additional details.

---

**`amazon_bedrock.SWAIG`** `object`

An array of JSON objects to create user-defined functions/endpoints that can be executed during the dialogue.

See [`SWAIG`][SWAIG] for additional details.

---

## post\_prompt

The `post_prompt` object accepts either a plain text prompt or a structured POM prompt, plus optional tuning parameters.

#### Regular prompt

**`post_prompt.text`** `string` — required

The main identity prompt for the AI. This prompt will be used to outline the agent's personality, role, and other characteristics.

---

**`post_prompt.temperature`** `number`

Controls the randomness of responses. Higher values (e.g., 0.8) make output more random and creative, while lower values (e.g., 0.2) make it more focused and deterministic. Range: 0.0 to 1.0.

---

**`post_prompt.top_p`** `number`

Controls diversity via nucleus sampling. Only tokens with cumulative probability up to top\_p are considered. Lower values make output more focused. Range: 0.0 to 1.0.

---

**`post_prompt.confidence`** `number`

Minimum confidence threshold for AI responses. Responses below this threshold may be filtered or flagged. Range: 0.0 to 1.0.

---

**`post_prompt.presence_penalty`** `number`

Penalizes tokens based on whether they appear in the text so far. Positive values encourage the model to talk about new topics.

---

**`post_prompt.frequency_penalty`** `number`

Penalizes tokens based on their frequency in the text so far. Positive values decrease the likelihood of repeating the same line verbatim.

---

#### POM prompt

**`post_prompt.pom`** `object[]` — required

An array of objects that defines the prompt object model (POM) for the AI. The POM is a structured data format for organizing and rendering a prompt for the AI agent. This prompt will be used to define the AI's personality, role, and other characteristics. See the [`POM technical reference`](/docs/swml/reference/calling/amazon-bedrock/prompt) for more information.

---

**`post_prompt.temperature`** `number`

Controls the randomness of responses. Higher values (e.g., 0.8) make output more random and creative, while lower values (e.g., 0.2) make it more focused and deterministic. Range: 0.0 to 1.0.

---

**`post_prompt.top_p`** `number`

Controls diversity via nucleus sampling. Only tokens with cumulative probability up to top\_p are considered. Lower values make output more focused. Range: 0.0 to 1.0.

---

**`post_prompt.confidence`** `number`

Minimum confidence threshold for AI responses. Responses below this threshold may be filtered or flagged. Range: 0.0 to 1.0.

---

**`post_prompt.presence_penalty`** `number`

Penalizes tokens based on whether they appear in the text so far. Positive values encourage the model to talk about new topics.

---

**`post_prompt.frequency_penalty`** `number`

Penalizes tokens based on their frequency in the text so far. Positive values decrease the likelihood of repeating the same line verbatim.

---

## post\_prompt\_url callback

SignalWire sends the report to your `post_prompt_url` as an HTTP `POST`.

See the [Amazon Bedrock post-prompt callback](/docs/apis/rest/webhooks/bedrock-post-prompt-callback)
webhook page for the full field reference.

### Responding to post prompt requests

Answer with any 2xx status. The body is not read, so `{"response": "ok"}` is as good as an empty
one.

## Amazon Bedrock example

The following example selects Bedrock's **Tiffany** voice using the [voice\_id](/docs/swml/reference/calling/amazon-bedrock/prompt) parameter in the prompt.
It includes scaffolding for a [post\_prompt\_url](#properties)
as well as several remote and inline functions using
[SWAIG](/docs/swml/reference/calling/amazon-bedrock/swaig).

#### YAML

```yaml
---
version: 1.0.0
sections:
  main:
    - amazon_bedrock:
        post_prompt_url: https://example.com/my-api
        prompt:
          voice_id: tiffany
          text: |
            You are a helpful assistant that can provide information to users about a destination.
            At the start of the conversation, always ask the user for their name.
            You can use the appropriate function to get weather information.
        post_prompt:
          text: Summarize the conversation.
        SWAIG:
          defaults:
            web_hook_url: https://example.com/my-webhook
          functions:
            - function: get_weather
              description: To determine what the current weather is in a provided location.
              parameters:
                properties:
                  location:
                    type: string
                    description: The name of the city to find the weather from.
                type: object
            - function: summarize_conversation
              description: Summarize the conversation.
              parameters:
                type: object
                properties:
                  name:
                    type: string
                    description: The name of the user.
```

#### JSON

```json
{
  "version": "1.0.0",
  "sections": {
    "main": [
      {
        "amazon_bedrock": {
          "post_prompt_url": "https://example.com/my-api",
          "prompt": {
            "voice_id": "tiffany",
            "text": "You are a helpful assistant that can provide information to users about a destination.\nAt the start of the conversation, always ask the user for their name.\nYou can use the appropriate function to get weather information.\n"
          },
          "post_prompt": {
            "text": "Summarize the conversation."
          },
          "SWAIG": {
            "defaults": {
              "web_hook_url": "https://example.com/my-webhook"
            },
            "functions": [
              {
                "function": "get_weather",
                "description": "To determine what the current weather is in a provided location.",
                "parameters": {
                  "properties": {
                    "location": {
                      "type": "string",
                      "description": "The name of the city to find the weather from."
                    }
                  },
                  "type": "object"
                }
              },
              {
                "function": "summarize_conversation",
                "description": "Summarize the conversation.",
                "parameters": {
                  "type": "object",
                  "properties": {
                    "name": {
                      "type": "string",
                      "description": "The name of the user."
                    }
                  }
                }
              }
            ]
          }
        }
      }
    ]
  }
}
```