Calling

amazon_bedrock

View as MarkdownOpen in Claude

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 Prompting Best Practices guide.

Properties

amazon_bedrock
objectRequired

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. 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 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 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 below.

amazon_bedrock.prompt
objectRequired

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

See 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 for additional details.

post_prompt

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

post_prompt.text
stringRequired

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.

post_prompt_url callback

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

See the Amazon 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 parameter in the prompt. It includes scaffolding for a post_prompt_url as well as several remote and inline functions using SWAIG.

1---
2version: 1.0.0
3sections:
4 main:
5 - amazon_bedrock:
6 post_prompt_url: https://example.com/my-api
7 prompt:
8 voice_id: tiffany
9 text: |
10 You are a helpful assistant that can provide information to users about a destination.
11 At the start of the conversation, always ask the user for their name.
12 You can use the appropriate function to get weather information.
13 post_prompt:
14 text: Summarize the conversation.
15 SWAIG:
16 defaults:
17 web_hook_url: https://example.com/my-webhook
18 functions:
19 - function: get_weather
20 description: To determine what the current weather is in a provided location.
21 parameters:
22 properties:
23 location:
24 type: string
25 description: The name of the city to find the weather from.
26 type: object
27 - function: summarize_conversation
28 description: Summarize the conversation.
29 parameters:
30 type: object
31 properties:
32 name:
33 type: string
34 description: The name of the user.