Ergo Field GuideAWS product page
Menu

Get started with Amazon Ergo

Run Amazon Ergo on Bedrock with a ten-line Python example. Verify a real CSV result, estimate token costs, fix setup errors, and try three useful workflows.

Start with one line of test data and a question whose answer you can check by hand. In this walkthrough you will send a short CSV row to Amazon Ergo through Amazon Bedrock, inspect the text it returns, and use the token counts to estimate the cost. The same setup works for a code review or a support handoff once you have checked the first response.

Choose how to access Ergo

Bedrock hosts the model for you. Your script sends a request to an AWS endpoint, and your AWS account pays for inference. This is a practical route if you want to evaluate responses before committing to hardware. If operating the model on your own infrastructure is the goal, choose a checkpoint and look at the hardware recipes in the weights and self-hosting guide.

You can also use the request playground to explore the shape of a request before you set up AWS. Edit a prompt and export the JSON. The builder runs in your browser. The model runs when you submit that request to your configured endpoint.

Prepare your AWS environment

  1. Choose an AWS identity. Use the profile or role that should be billed. It needs permission to invoke Ergo through the inference profile you select. For the nonstreaming call below, the relevant action is bedrock:InvokeModel. AWS provides the corresponding resource examples in its model access instructions.
  2. Choose a region and profile. The example uses Oregon, us-west-2, and the global cross-region profile. If your workload requires US routing, choose us.amazon.ergo-1.0 and a supported source region. A cross-region profile determines where AWS can process the request. Review the AWS regional availability table for your choice.
  3. Prepare Python. In the environment where you plan to run your test, install the current AWS SDK with python -m pip install --upgrade boto3. Configure your usual AWS credentials for that environment. Keep those credentials outside the script and leave them out of example prompts.

Send your first Converse request

Save the following as first_ergo.py and run python first_ergo.py. The quote marks around the name belong to the CSV row. Keeping them in the prompt makes the test meaningful. The script prints any returned text blocks, followed by the SDK’s usage dictionary.

import boto3
runtime = boto3.client("bedrock-runtime", region_name="us-west-2")
prompt = 'Return only a JSON array of fields for this CSV row: "Doe, Jane",Boston'
response = runtime.converse(
    modelId="global.amazon.ergo-1.0",
    messages=[{"role": "user", "content": [{"text": prompt}]}],
)
blocks = response["output"]["message"]["content"]
print("".join(block["text"] for block in blocks if "text" in block))
print(response["usage"])

Check what the model returned

The expected array is ["Doe, Jane", "Boston"]. The first comma sits inside a quoted field. The second one separates the two fields. Extra whitespace between the array elements is fine. An answer containing three separate strings fails the test. You can confirm the expected result independently with Python’s standard library.

import csv
assert next(csv.reader(['"Doe, Jane",Boston'])) == ["Doe, Jane", "Boston"]

For a second test, change the row to Ada,. The expected array is ["Ada", ""]. This catches a different error, silently dropping an empty final field. If you need an application to consume the response, parse its text as JSON and compare the resulting list with your expected list. A plausible-looking sentence is insufficient for a downstream parser.

Estimate the cost of one run

Read the inputTokens and outputTokens counters from the usage dictionary. At the global standard rates AWS lists for ordinary uncached input and output, an illustrative request with 2,000 input tokens and 500 output tokens costs $0.0035. The input contributes $0.002 and the output contributes $0.0015. These numbers demonstrate the calculation. Your CSV example will have its own counts.

Each additional inference request adds usage, including a second attempt with a revised prompt. When comparing several prompts, record the profile, successful responses, and total token counts across all attempts. The token cost calculator lets you change the profile and include cache reads and writes. Consult the provider rate table when setting a budget.

Diagnose a failed first run

  • Missing or expired credentials. Select or refresh the AWS profile used by this terminal. If several profiles are available, check which one the script resolves before trying again.
  • Access denied. Check the account, role, region, inference-profile permissions, and access to the underlying model. If your organization restricts processing regions, compare those rules with the profile’s routing scope.
  • Validation error. Check the exact profile ID and the nested messages structure. A Converse message expects a list of content blocks. Start with the unchanged example and alter one field at a time. The API guide explains the request in more detail.

Apply the same check to your own work

Pick a task with a small input and an observable outcome. In the code review walkthrough, run both parser versions against the same row. In the configuration migration example, compare the settings produced before and after the change. For a support handoff, check each ticket ID and supporting quote against the source message before assigning an owner.

Keep the prompt, expected result, and actual result together. When you change the instructions or switch inference profiles, rerun that same example. This gives you a repeatable check and makes it easier to see whether a change helped.