Amazon Bedrock

Updated

Integrate Amazon Bedrock LLMs with the Conversational AI Engine.

Amazon Bedrock provides access to a variety of foundation models (FMs) from leading AI providers through a fully managed AWS service.

Sample configuration

The following example shows how to configure Amazon Bedrock LLM when starting a conversational AI agent.

from agora_agent import Agent, AmazonBedrock

# client is your configured Agora client
agent = (
    Agent(client)
    .with_stt(...)  # configure your STT vendor
    .with_llm(AmazonBedrock(
        access_key='your-aws-access-key-id',
        secret_key='your-aws-secret-access-key',
        region='us-east-1',
        model='us.anthropic.claude-sonnet-4-20250514-v1:0',
        system_messages=[{'role': 'system', 'content': 'You are a helpful chatbot.'}],
    ))
    .with_tts(...)  # configure your TTS vendor
)
import { Agent, AmazonBedrock } from 'agora-agents';

// client is your configured Agora client
const agent = new Agent({ client })
  .withStt(/* configure your STT vendor */)
  .withLlm(new AmazonBedrock({
    accessKey: 'your-aws-access-key-id',
    secretKey: 'your-aws-secret-access-key',
    region: 'us-east-1',
    model: 'us.anthropic.claude-sonnet-4-20250514-v1:0',
    systemMessages: [{ role: 'system', content: 'You are a helpful chatbot.' }],
  }))
  .withTts(/* configure your TTS vendor */);
import "github.com/AgoraIO/agora-agents-go/v2/agentkit/vendors"

// client is your configured Agora client
agent := agentkit.NewAgent(client).WithStt(/* configure your STT vendor */).
  WithLlm(
    vendors.NewAmazonBedrock(vendors.AmazonBedrockOptions{
        AccessKey: "your-aws-access-key-id",
        SecretKey: "your-aws-secret-access-key",
        Region:    "us-east-1",
        Model:     "us.anthropic.claude-sonnet-4-20250514-v1:0",
        SystemMessages: []map[string]interface{}{
            {"role": "system", "content": "You are a helpful chatbot."},
        },
    }),
).WithTts(/* configure your TTS vendor */)

Use the following llm configuration in your request:

"llm": {
    "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/us.anthropic.claude-sonnet-4-20250514-v1:0/converse-stream",
    "api_key": "<your_bedrock_api_key>",
    "access_key": "<your_aws_access_key_id>",
    "secret_key": "<your_aws_secret_access_key>",
    "region": "us-east-1",
    "model": "us.anthropic.claude-sonnet-4-20250514-v1:0",
    "system_messages": [
        {
            "role": "system",
            "content": "You are a helpful chatbot."
        }
    ],
    "style": "bedrock"
}

Key parameters

llmrequired
urlstring
required

The Amazon Bedrock runtime endpoint for the target region and model. See Amazon Bedrock endpoints and quotas for the correct endpoint format.

api_keystring
optional

Your Bedrock API key for authentication. Use either api_key alone, or both access_key and secret_key together for authentication.

access_keystring
optional

Your AWS Access Key ID for authenticating Bedrock API calls. Required if not using api_key. Must be used together with secret_key. Get your access key from the AWS IAM Console.

secret_keystring
optional

Your AWS Secret Access Key for authenticating Bedrock API calls. Required if not using api_key. Must be used together with access_key. Get your secret key from the AWS IAM Console.

regionstring
required

The AWS region hosting the Bedrock model, for example, us-east-1 or us-west-2. See Supported Regions and models for available regions.

stylestring
required

The API style to use. Set to bedrock for Amazon Bedrock models.

For advanced configuration options, model capabilities, and detailed parameter descriptions, see the Amazon Bedrock documentation.