Skip to main content

Setup

To get started, ensure you have the following prerequisites installed on your system:

Pull and Run the Docker Image

Pull the prebuilt Dome container image from GitHub Container Registry:
Create a .env file with the following environment variables:
The DOME_API_KEY is an authentication key for validating incoming API requests. If you enable Guardrails that make external API calls such as OpenAI moderation or detectors hosted on Groq or any other AI inference service, include the corresponding API keys here as well. Run the container:

Test the Dome Application Locally

Check if your Docker container is running, use the curl command below.
You can test the Dome application locally by sending requests to the different API endpoints.

Add/Update Dome Config

To add or update the Dome configuration, send a PATCH request to the /config endpoint with the desired configuration settings in the request body. For example:
This endpoint updates the default Dome configuration to include specific input and output Guards, as well as the methods used for each Guard. Here is a Python snippet showing how to send the above request in your code:

Check Inputs

To check and Guard against inputs to agents, send a GET request to the /async_input_detection endpoint with the input prompt. For example:
Below is a Python snippet showing how to send the above request in your application code:
This endpoint checks the provided input/prompt against the configured input Guards and returns any detections. For this particular prompt:
The response is shown here:
This shows that the input was flagged by the prompt-injection Guard using the prompt-injection-mbert method.

Check Outputs

To check and guard against outputs from agents, send a GET request to the /async_output_detection endpoint with the output string/agent response. For example:
A Python snippet for the above request is shown below:
This endpoint checks the provided agent’s output against the configured output Guards and returns any detections. For this particular agent output:
The response is shown here:
This shows that the output was flagged by the output-toxicity Guard using the moderation-mbert method.

Passing Agent ID in Detection Requests

The AGENT_ID can also be passed dynamically as a query parameter on individual detection requests. This is useful when multiple agents share the same Dome deployment:
Here is the corresponding Python code snippet for the above request:

Check Batches

To check inputs or outputs in batches, use the /batch/async_input_detection and /batch/async_output_detection endpoints. These process items concurrently and are useful for handling high volume requests efficiently. Batch Input Detection Use /batch/async_input_detection endpoint to check multiple prompts at once. For example:
The example Python code for above request is shown below:
The response is shown here:
Batch Output Detection Use /batch/async_output_detection to check multiple agent responses at once. For example:
The example Python code for above request is shown below:
The response is shown here:

Bedrock Guardrails API

Dome exposes an AWS Bedrock Guardrails-compatible ApplyGuardrail endpoint, allowing existing Bedrock integrations to use Dome as a drop-in replacement.

Setup

Start by setting the BEDROCK_GUARDRAILS_API environment variable to true in your .env file:
This will enable the Bedrock Guardrails API in Dome, allowing it to accept requests in the format expected by Bedrock Guardrails.

Test the Bedrock Guardrails API

The /guardrails/apply endpoint evaluates content using Dome Guardrails and returns results in a structure compatible with the ApplyGuardrail API from Amazon Bedrock. The endpoint accepts content items and routes them through either input Guards or output Guards, depending on the specified source. To test the Bedrock Guardrails API, send a POST request to the /guardrails/apply endpoint with the prompt or agent output. For example:
The Python code for the above request is shown below:
Same pattern applies for checking agent outputs, just change source to OUTPUT and provide the agent responses in the content array.

The Response

The response follows the top-level structure used by the ApplyGuardrail API in Amazon Bedrock, including:
  • usage
  • action
  • output
  • assessments
Each item in the request’s content array produces a corresponding entry in the assessments list. Dome groups Guards into Bedrock policy categories based on the Guard type. Each Guard entry includes:
  • action
  • confidence
  • score
  • triggeredMethods
Below is an example response where the first message is safe and the second triggers a prompt injection Guard.

Differences from the native Bedrock API

  • No Guardrail identifier required. The Bedrock ApplyGuardrail API normally takes guardrailIdentifier and guardrailVersion as path parameters. But Dome uses its own configuration, hence these are not needed. Only the request body is all that is required.
  • Confidence is based on scores. For the native Bedrock API, confidence comes from the Bedrock model. While in Dome’s response, confidence is comes from the Guard’s detection_score (0.0–1.0) using a threshold mapping shown below. The raw score is also included in each assessment entry for precise values.
  • Dome-specific fields. Each assessment entry includes triggeredMethods (the detector class names that fired) and score alongside the standard Bedrock fields.
  • Usage counters are zero. Dome does not track Bedrock-style policy units, so all usage values are 0.

Observability and OpenTelemetry Instrumentation

The Dome container is well set up for instrumentation to emit telemetry data that is metrics, traces, and logs using OpenTelemetry (OTEL). This allows you to monitor Dome’s behavior and performance from any compatible observability backend. To enable instrumentation, add the following variables to your .env file:
Then start the container with the .env file:

Sending Telemetry to Vijil Console or Evaluate

If you want telemetry to appear inside the Vijil Console or an enterprise Vijil Evaluate deployment, also add the following to your .env file:
These variables are not required if you are exporting telemetry to a third-party observability platform.
Last modified on July 16, 2026