Ergo Field GuideAWS product page
Menu

Amazon Ergo API quickstart

Call Ergo through Amazon Bedrock Converse with Python, select an inference profile, and inspect response text and usage.

Make a Converse request

Use Python with current Boto3 and an AWS identity allowed to invoke Ergo through the chosen inference profile. Set credentials in your normal AWS environment. The example asks about CSV tests and prints the text and usage returned by Bedrock.

python -m pip install --upgrade boto3
import boto3

runtime = boto3.client("bedrock-runtime", region_name="us-west-2")
response = runtime.converse(
    modelId="global.amazon.ergo-1.0",
    messages=[{
        "role": "user",
        "content": [{"text": "Suggest three test cases for a CSV reader that accepts quoted commas."}],
    }],
)
for part in response["output"]["message"]["content"]:
    if "text" in part:
        print(part["text"])
print(response["usage"])

Choose the inference profile

The example uses global.amazon.ergo-1.0. The US cross-region profile is us.amazon.ergo-1.0. AWS lists the source regions for each profile. Check that table when changing the endpoint region or when your workload has routing requirements. See the model IDs and regional availability.

Check the result and the bill

Read the returned examples and run them against a sample parser. The usage object gives you input and output counts for the request. Estimates on this site are for planning. Your AWS account reports actual usage and charges.

If the first call fails

  • Access denied. Check the calling identity, its Bedrock invocation permissions, and access to the chosen profile.
  • Invalid model or profile. Check the profile spelling and the source region’s availability for that profile.
  • Missing credentials. Select the AWS profile or role you intended to use and verify it in your own environment.

The official model card also includes examples for the Responses and Chat Completions APIs. Read the AWS API samples.