How promptfoo tests models on your SageMaker AI endpoints
A team that hosts its own model on Amazon SageMaker AI needs evals and red team scans run against that exact endpoint, not against a similar model elsewhere. promptfoo's sagemaker provider is built for this case. It covers models on SageMaker AI endpoints, including Hugging Face models, custom models and JumpStart models, so the configuration points at the endpoint your application already calls. AWS-managed foundation models that have no custom endpoint of your own use the Bedrock provider instead. Check which of the two applies before you write any configuration, because the choice determines the provider ID, the credentials path and how the model is named in results.
Because promptfoo runs locally, the evaluation machine or CI runner makes the calls itself. Prompts travel from that machine directly to your endpoint, and promptfoo does not route them through a promptfoo-hosted service. Your team therefore controls where the test runner executes, which AWS credentials it holds and which network paths it can reach. Confirm that the runner can reach the endpoint's region and that its IAM principal is limited to invoking that endpoint. Also confirm whether your organization permits red team prompts to be sent from a laptop or only from a managed runner.
Test the endpoint's behavior, not only its model card. Run a small smoke suite first to confirm the request and response shape, since custom containers often expect payloads that differ from the standard chat format. Then run your quality assertions and red team plugins against the same endpoint name you deploy, and record the endpoint name and deployed model version alongside the results. Ask your platform team which version is live and whether it changes during the test window, so a pass or fail can be traced to the exact artifact that was tested.
What you need before the first SageMaker eval runs
Most failed first runs against SageMaker AI endpoints trace back to a missing prerequisite rather than a bad config. The five items below cover the runner, the AWS account, permissions, credentials and network path, and each one needs a check before you write the first provider block.
Node.js version on the runner
The current promptfoo release requires Node.js 22.22.0 or newer, so the machine or CI image that runs your evals must meet that floor before anything else. Check with node --version on the same host and user account that will execute npx promptfoo eval. An older runtime in a shared CI image is a common reason a SageMaker run fails before it reaches AWS.
An active endpoint in the account
The provider calls a SageMaker AI endpoint that is already in service, not a model or a training job. Confirm the endpoint name, its status and the region it lives in, and whether it serves a JumpStart model, a Hugging Face container or your own container. If the model is an AWS-managed foundation model with no endpoint of your own, the Bedrock provider is the route instead.
IAM permission to invoke the endpoint
The identity that runs the eval needs permission to invoke the specific endpoint, and nothing broader. Ask your AWS administrator for the exact invoke action and resource ARN, then confirm the action names against the promptfoo SageMaker documentation and your own account's policy simulator. Test traffic should use a role scoped to the evaluation endpoint, not a shared administrator identity.
SageMaker provider docsCredential source the runner can reach
Decide how the runner gets AWS credentials before you build the pipeline: the standard AWS credential chain on a developer machine, an instance or task role on a CI agent, or short-lived role assumption. Long-lived access keys copied into CI variables are the weakest option and are hard to rotate. Confirm which credential sources your promptfoo version reads and which region the client uses, since both settings are easy to get wrong silently.
Network path from runner to endpoint
The test runner must reach the SageMaker AI runtime in the endpoint's region. Check whether the runner sits in a private subnet, behind a corporate proxy, or inside a VPC where a VPC endpoint or egress rule controls access. Run a single invocation from that exact host before scheduling evals, because a blocked route looks like a timeout in promptfoo rather than a clear permissions error.
Configuring the sagemaker provider step by step
This sequence takes you from a clean workstation to a promptfoo run that calls your own SageMaker AI endpoint and writes results you can review. Each step ends with a check, so a failure is caught at the point where it occurs.
Install promptfoo and confirm the runtime
Install the promptfoo package on the workstation or CI runner that will run evals. The npm release requires Node.js 22.22.0 or newer, so confirm the Node version first with
node --version, then install promptfoo with npm and check the CLI responds withpromptfoo --version. Done means the command prints a version number without errors. If you run promptfoo in a locked-down build image, confirm with your platform team that the package can be pulled from your registry.Confirm the endpoint name and region
Ask the team that deployed the model for the exact SageMaker AI endpoint name, not the model name or the endpoint configuration name, and the AWS region where it runs. Check both in the SageMaker AI console or with the AWS CLI by listing endpoints in that region. Confirm the endpoint status is InService and that you have the request payload format the model expects, because a custom container may accept a different input shape than a JumpStart model. Done means you can name the endpoint, its region and its expected request format in one note.
Set AWS credentials through the standard chain
Provide credentials through the standard AWS credential chain rather than writing keys into the config file. For a laptop, that usually means a named profile or a single sign-on session; for CI, an assumed role or workload identity. Give the principal permission to invoke the specific endpoint, and confirm with your cloud team which policy grants that. Verify the identity with
aws sts get-caller-identityin the same shell where promptfoo runs. Done means the command returns the account and role you expect.Write the sagemaker provider entry
Create or open the promptfoo config file, for example
promptfooconfig.yaml, and add a provider entry that points at the SageMaker AI endpoint by its name and region. Use the provider ID form documented for the SageMaker provider in the promptfoo docs, and set the request and response shape so it matches the model's contract. Keep the endpoint name in one place so it can change without touching test cases. Done means the file parses, which you can confirm by runningpromptfoo validateif your version provides it, or by reaching the next step without a configuration error.Run a single smoke-test prompt
Before running the full suite, send one short, known prompt through the provider to confirm the endpoint answers. Use a single test case with a simple expected behavior, then run promptfoo eval against that one case. Check the output for a response from the endpoint, not an authentication or validation error. If it fails with an access error, return to the credentials step; if it fails with a payload error, return to the request shape in the provider entry. Done means one row shows a completed model response in the results.
Run the full suite and review results
Once the smoke test passes, add your full set of test cases and run the complete eval. Open the results view with promptfoo view or export them to a file, then check that every test case returned a model output and that pass and fail counts match what you expect from your assertions. Spot-check several responses by hand, since a passing assertion only proves the output matched your rule. Done means the run completes for all cases and the outputs you sampled read as genuine model responses from your endpoint.
JumpStart, Hugging Face and custom container endpoints
JumpStart models are packaged by AWS with serving containers and input and output conventions that AWS documents for each model family. Because the container is managed, the request body and response structure are usually fixed by that model's package rather than by your application code. Your job is to confirm which payload the deployed endpoint accepts, then configure promptfoo to send exactly that structure and read the field that holds the generated text.
- Confirm the input schema: Check the endpoint's documented input format in the SageMaker console or model card, including whether prompts are sent as a plain string or inside a structured object.
- Match the response field: Note the key that carries generated text in the response, since promptfoo assertions run against the extracted output, not the raw JSON.
- Set generation parameters explicitly: Record which inference parameters the model accepts so your test runs use the same settings as production.
- Pin the endpoint version: Record the model package version, because a JumpStart update can change the response shape between evaluations.
- Plan a parser when the shape differs: If the response wraps text in a list or nested object, add a transformation step so assertions see plain text.
Before the first full run, send one request by hand and compare the raw body with the configuration you wrote.
Hugging Face models deployed on SageMaker AI run in containers that come from the Hugging Face inference toolkit or a Hugging Face serving image. These containers commonly accept a JSON body with an inputs field and optional parameters, but the exact contract depends on the task type and the image version you deploy. Confirm the contract against the model card and container documentation for your deployment rather than assuming it matches the OpenAI chat format.
- Identify the task type: Text generation, chat completion and embedding tasks often use different request and response shapes, so confirm which one the endpoint serves.
- Check for chat templates: Some deployments apply the model's chat template server-side and others expect you to format the conversation yourself. Test which applies before writing prompt templates.
- Read the generated-text field: Responses may be a list of objects, a single object or a plain string. Write the extraction logic against the real output of your endpoint.
- Handle stop sequences and token limits: Confirm which generation parameters the container honors, because unsupported keys may be ignored without an error.
- Watch for truncated output: Compare the response length with your token limit so assertions do not grade cut-off text as a complete answer.
Record the image tag and task type in your test configuration so a later redeploy is easy to compare.
Custom containers give you the most control and the most responsibility. Your team defines the request parser, the inference code and the response format, so promptfoo can only work with what your container actually returns. The contract lives in your serving code, which means the documentation your team writes is the reference the test configuration must follow. A custom container that returns structured JSON, a bare string or a streamed body needs a different provider setup in each case.
- Document the contract in code: Write down the accepted request fields, required headers and the exact response structure in the same repository as the container.
- Keep a sample request set: Store a few representative inputs and their raw responses so you can rebuild the configuration after a change.
- Surface errors clearly: Confirm that failures return status codes and messages promptfoo can record, rather than an empty body that looks like a successful answer.
- Decide where parsing lives: Put extraction in the container or in promptfoo transformation logic, and choose one place so the contract does not split across two codebases.
- Test health checks separately: Confirm that endpoint readiness does not depend on the model being loaded, so evaluations do not start against a cold container.
Ask the team that owns the container to confirm the response contract in writing before any evaluation uses it.
Mapping endpoint names, regions and response fields to promptfoo config
This table maps the SageMaker details you already have, such as endpoint name, region and credentials, to the promptfoo config keys that use them. Read it as a checklist: set each row once, then confirm the exact key names and value formats against the official SageMaker provider page before running an eval. The main takeaway is that most failed first runs trace back to a region mismatch or a response path that does not match the container's output.
| Setting | Where it goes in promptfoo | What to confirm |
|---|---|---|
| SageMaker endpoint name | Provider ID that names the endpoint, as shown in the provider documentation | The endpoint name must match the one shown in the SageMaker console for the account and region you test |
| AWS region | Region setting on the provider, or the region from your AWS environment | The region must be the one where the endpoint is deployed, not where your CI runner happens to run |
| Credential source | AWS credentials from the environment, shared config profile or assumed role used by the provider | The identity needs permission to invoke the endpoint, and CI should use a role scoped to that endpoint only |
| Request template fields | Body template the provider sends, with the prompt inserted where the test variable appears | The payload shape must match what your inference container expects, such as the JSON fields it reads |
| Response field path | Path or parser that extracts the model text from the returned JSON | The path must match the container's output, which differs between JumpStart models and custom containers |
| Model or inference options | Generation parameters passed in the request body, such as token limits and temperature | Confirm which parameters your container accepts, since unknown fields can cause errors or be ignored |
| Test variable placement | Where the prompt variable sits in the template, so each test case reaches the model | Send one known prompt first and check the raw response before writing assertions |
When to use the Bedrock provider instead of SageMaker AI
Use the SageMaker AI provider when the model is one your team deploys and operates on a SageMaker AI endpoint, whether that is a Hugging Face model, a JumpStart model or a custom container you built. Use the Bedrock provider when the model is an AWS-managed foundation model that you call through Amazon Bedrock without provisioning your own endpoint. The deciding question is who owns the serving stack: if your team controls the instance type, container image, scaling and model artifacts, the test target is a SageMaker AI endpoint, and the SageMaker AI provider is the right entry point. If AWS runs the model and you only choose a model ID, the Bedrock provider applies.
Many organizations run both, and one promptfoo suite can compare them. A single config can list a SageMaker AI endpoint and a Bedrock model side by side, so the same prompts, assertions and red team plugins score a self-hosted candidate against a managed baseline. Keep the provider blocks separate, check that the grader you choose can reach both, and confirm that each provider reads AWS credentials from the source your CI runners actually use. Results from the two providers can differ for reasons unrelated to model quality, such as endpoint timeouts, request formats or content filtering, so record which provider produced each result.
Before you commit to either path, read the sibling topic on testing Amazon Bedrock models with promptfoo only for its model ID and inference profile guidance, then check the Bedrock page for regional availability, guardrail settings and credential handling. Confirm with your AWS account team which models are available in your region and which Bedrock features your compliance reviewers expect to see in test evidence. If a model appears in both catalogs, decide in advance which deployment you are evaluating, because a test of a managed model says nothing about the endpoint you operate, and the reverse holds too.
Securing AWS access and test data for SageMaker endpoints
A promptfoo run against a SageMaker endpoint touches AWS credentials, prompts that may contain sensitive material, and stored responses. The cards below cover the access, data and deployment decisions that determine whether that testing stays inside the boundary your security team approved.
Least-privilege IAM for the test runner
Give the identity that runs promptfoo permission to invoke only the specific SageMaker AI endpoint under test, not every endpoint in the account. Scope the policy to the endpoint's ARN and the region it lives in, and keep administrative and model-management actions out of the role. Before the first full run, confirm in a sandbox that a denied action fails as expected, so a broad policy does not go unnoticed.
No long-lived keys in config files
A promptfoo configuration file is usually committed, shared or copied into CI logs, so it should never hold static AWS access keys. Use the default AWS credential chain, such as a short-lived role assumed by the CI job or a profile on a developer workstation. Ask your platform team which mechanism your pipeline supports, and check that the promptfoo config contains endpoint names and regions only.
Storage for red team prompts and responses
Red team runs record the attack prompts sent to the endpoint and the model's replies, which may include sensitive or policy-violating content. Decide where result files and any shared views are written, and make sure that location matches your data classification rules and retention policy. Confirm the retention period your organization requires before you choose an output directory on a shared runner.
A dedicated test endpoint
Run red team scans against a separate test endpoint or a tagged test variant rather than the production endpoint that serves customers. This keeps adversarial traffic out of production metrics, budgets and logs, and lets you change the model container during testing without affecting users. Ask the endpoint owner whether test traffic can be identified in CloudWatch and billing reports.
Local runs keep data off third-party services
promptfoo runs on your machine or CI runner and calls the endpoint directly, so the test data does not pass through a promptfoo-hosted service. Check any grader model you configure, since an LLM-as-a-judge assertion sends responses to whichever model performs grading. If your data rules prohibit external grading, point the grader at a model inside your own boundary.
Sharing results and the self-hosted limits
Self-hosted promptfoo stores data in a local SQLite database that cannot be shared across replicas, and it has no RBAC, built-in authentication or SSO. It is not recommended for production use, so do not expose it to a wider team as a shared results service without a review. If several teams need shared results with access control, evaluate the Enterprise or On-Premise editions, and confirm how they meet your identity requirements.
Self-hosting docsHow a promptfoo run reaches a SageMaker AI endpoint
The run starts with an engineer or CI job invoking the promptfoo CLI on a runner the team controls. The CLI resolves AWS credentials from its configured sources, then sends inference requests to the SageMaker AI endpoint inside the AWS account, which is the trust boundary to review. Responses return to the CLI, and results stay on the runner unless you forward them to a self-hosted promptfoo server. Check the credential source and the endpoint name first, because both determine which account the run touches.
Requests leave the runner with AWS credentials and return to local results.
Common SageMaker provider errors and how to fix them
This table lists the failures teams most often hit when pointing promptfoo at a SageMaker AI endpoint, with the likely cause and the first check for each. Work down the rows in order, since region, endpoint name and credentials fail before payload and timing problems appear.
| Symptom | Likely cause | First check |
|---|---|---|
| Endpoint not found | Endpoint name is wrong, or it sits in a different region from the one the provider is configured for | Compare the endpoint name and region in the SageMaker console with your promptfoo provider config, character for character |
| Access denied when invoking | The IAM identity running promptfoo lacks permission to invoke the endpoint | Confirm the identity has invoke permission on that endpoint ARN, and check any service control policy or permissions boundary that may block it |
| Credentials not resolved or expired | No AWS credentials reach the process, the wrong profile is active, or temporary session credentials have expired | Run a simple AWS CLI identity check from the same shell or CI job that runs promptfoo, and confirm which profile or role is in use |
| Response fails to parse or is empty | Request payload does not match what the model container expects, or the response shape differs from the parser in the provider config | Send one hand-written request to the endpoint with the same body, then compare its raw output with the transform used in the config |
| Requests time out on first call | The endpoint is scaled to zero or still starting, so the first invocation waits for capacity | Check the endpoint status and instance count, send a warm-up request, then rerun with a longer timeout before judging results |
| Intermittent throttling or errors under load | Concurrency in promptfoo exceeds what the endpoint instances can serve | Lower the concurrency setting for the run and check endpoint invocation error metrics in CloudWatch |
| Wrong model answers during a test | The test points at a different endpoint or model variant than the one under review | Confirm the endpoint name in the run output matches the deployed endpoint you intended to test |
Questions buyers ask about SageMaker AI testing with promptfoo
Is promptfoo free to use with SageMaker AI endpoints?
Yes, the core tool is free. promptfoo is licensed under the MIT license, and the Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. The SageMaker provider is part of that set of providers, so connecting it does not require a paid edition. Paid tiers add team sharing, SSO, role-based access control, continuous monitoring and priority support with SLAs. Those are priced on request, so ask for a quote if you need them. Your AWS usage for the endpoints and any model calls is billed by AWS separately from promptfoo.
How much effort does connecting promptfoo to a SageMaker endpoint take?
The effort depends mainly on how the endpoint accepts requests and how many models you compare. A single JumpStart or Hugging Face endpoint with a standard request format is the simplest case: you configure the provider, confirm the endpoint responds, and write a first eval. Custom containers add work because the request and response shapes are defined by your code, so you may need to adjust the provider configuration or write a small wrapper. Effort also grows with the size of your test suite, the number of endpoints, and how often the suite runs in CI. No duration is set here, so ask a partner or your own engineers to estimate after reviewing the endpoint contract.
What does the team need to supply before testing starts?
Plan to supply three inputs. First, AWS access: an identity with permission to invoke the target endpoints, and a region where they are deployed. Second, endpoint details: the endpoint name, the model type (JumpStart, Hugging Face or custom), and a sample request and response so the provider can be configured correctly. Third, test data: prompts that reflect real use, expected behavior for each case, and any policy or red teaming scope agreed with your security team. Your team should also decide where results are stored and who may view them, since promptfoo keeps evals on the machine running them unless you deploy the self-hosted server.
Can our own engineers set this up in-house?
Often yes, if the team already runs SageMaker AI and has someone comfortable with Node.js and command-line tools. The promptfoo documentation covers the SageMaker provider, and a single endpoint can be tested with a short configuration file. In-house work usually stalls on the parts that are specific to your environment: custom container contracts, IAM permissions, consistent grading criteria, and wiring the suite into CI/CD. Assign an owner for the eval suite so it is maintained as models change. Check the current provider documentation before you start, because provider options can change between releases.
When is outside help worth it for SageMaker AI testing?
Outside help is most useful when the test program must produce evidence for a security review or audit, when many endpoints or custom containers are involved, or when the team lacks time to build and maintain the suite. DeployOpen plans, implements and documents self-hosted platforms in your own AWS accounts or data centers, and runs security testing of AI systems and agents, with a fixed scope agreed in writing before work starts. Ongoing testing can be covered by a retainer. For evidence, note that DeployOpen prepares controls and evidence for compliance assessments but does not issue audit reports or certifications.
Should we use the Bedrock provider instead of the SageMaker provider?
Use the SageMaker provider when the model runs on an endpoint you deploy in SageMaker AI, including JumpStart, Hugging Face and custom models. Use the Bedrock provider for AWS-managed foundation models that do not need a custom endpoint. The choice follows where the model is hosted, not which cloud you use. If one application mixes both, you can keep both providers in one configuration and compare them on the same test cases.
What usually goes wrong when testing SageMaker endpoints?
The most common failures are mismatched request formats, missing IAM permissions for the calling identity, and endpoints that are in a different region than the configuration expects. Custom containers often return responses in a shape the provider does not parse by default, so the first eval run may show empty or malformed outputs. Also confirm that the endpoint is in service before running a large suite, since idle or scaled-down endpoints can fail or slow the run. Test one prompt manually first, then scale up. Keep a record of endpoint names and versions alongside eval results so failures can be traced to a deployment change.
How DeployOpen works on this
DeployOpen plans and runs promptfoo testing against the SageMaker AI endpoints you already operate, inside your own AWS accounts and network. Work starts from a written scope that names the endpoints, the test suites and the evidence your teams need to review.
How we scope
- Inventory which SageMaker AI endpoints host custom, Hugging Face or JumpStart models and which AWS-managed models should use the Bedrock provider.
- Agree the endpoint names, regions, invocation payload formats and the AWS credential source the test runner will use.
- Confirm which evaluation suites, red team plugins and pass-rate thresholds are in scope, and who approves the test data.
How we build
- Configure the promptfoo sagemaker provider for each endpoint and verify a single request and response before any suite runs.
- Write evaluation suites and red team configurations against your use cases, with grading and assertions reviewed with your team.
- Set up the test runner in your infrastructure, including IAM permissions scoped to invoking the agreed endpoints only.
How we hand over
- Deliver configuration files, suite definitions, run instructions and a short record of design decisions your engineers can maintain.
- Provide a findings report for red team results, with reproduction steps, affected endpoints and recommended fixes.
- Walk your engineering and security teams through the runs, so they can rerun the suites and interpret results without us.
How we support
- Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
- Ask for a quote based on the written scope, covering the endpoints, suites and handover items included.
- Ongoing support, upgrades of promptfoo and continuous testing are available as a retainer if your endpoints change over time.

