Skip to navigation
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 prompt engineering guide.

Properties

amazon_bedrock
objectRequired

An object that accepts the following properties.

amazon_bedrock.global_data
object

Initial data shared by all of the agent’s SWAIG functions. It is sent with every function call to your web_hook_url, is available to data_map templates under session_data.global_data, and is included in the post-prompt summary report. The set_global_data and unset_global_data actions change it during the call.

amazon_bedrock.params
object

A JSON object containing parameters as key-value pairs.

amazon_bedrock.post_prompt
object

Optional instructions for the summary written when the conversation ends, as a text string or a pom object array. When omitted, a default summary instruction is used. Has no effect unless post_prompt_url is set. See post_prompt details below.

amazon_bedrock.post_prompt_url
string

The URL that receives the conversation summary report when the conversation ends. The summary is written only when this is set. 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 object containing the user-defined functions the agent can call during the dialogue and their defaults.

See SWAIG for additional details.

post_prompt

The post_prompt object holds the instructions for the end-of-call summary, as either plain text or a structured POM prompt. The summary is written with fixed model settings, so post_prompt takes no tuning parameters. Set either text or pom, not both. If a document sets both at runtime, text is used.

post_prompt.text
stringRequired

The instructions for writing the summary of the conversation.

post_prompt_url callback

SignalWire sends the report to your post_prompt_url as an HTTP POST. Unlike the ai method’s post-prompt report, this request is not signed, so protect the endpoint with basic auth credentials embedded in the URL, in the form username:password@url. See Verify SWML request signatures.

Payload
{
"content_type": "text/json",
"content_disposition": "agent.summary",
"conversation_type": "voice",
"call_id": "2e1e66e5-5d07-413d-9668-55542992eec0",
"app_name": "bedrock",
"ai_session_id": "2e1e66e5-5d07-413d-9668-55542992eec0",
"action": "post_conversation",
"call_log": [
{
"role": "system",
"content": "You dispatch taxis."
},
{
"role": "user",
"content": "I need a ride to the airport."
}
],
"raw_call_log": [
{
"role": "assistant",
"content": "Your ride is booked for 6pm."
}
],
"post_prompt_data": {
"parsed": [
{
"intent": "book_ride",
"resolved": true
}
],
"raw": "{\"intent\":\"book_ride\",\"resolved\":true}"
},
"global_data": {
"customer_tier": "premium"
},
"swaig_log": [],
"conversation_summary": "Caller booked a ride from 123 Main St to the airport for 6pm."
}

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.

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