Skip to main content
TL;DR: Evaluate your Agent with Vijil, then call Dome.create_from_vijil_evaluation(evaluation_id, api_key) to build a Guardrail configuration tuned to the vulnerabilities that evaluation found. Optionally pass a latency_threshold to trade coverage for speed.
Rather than hand-picking Guards, you can let a Vijil evaluation drive your Dome configuration. This tutorial evaluates an unprotected Agent, generates a recommended configuration from the results, and re-evaluates the protected Agent to confirm the improvement. The full runnable code is in the AutotunedGuardrails tutorial folder.

Prerequisites

Install the dependencies and set your keys:
Obtain a Vijil API key from evaluate.vijil.ai. If you are on the free plan, you also need an Ngrok authtoken (NGROK_AUTHTOKEN), which Vijil uses to create a private HTTPS endpoint to your Agent. Premium users can skip this.

Walkthrough

1

Evaluate the Baseline Agent

Run safety and security harnesses against your unprotected Agent. When the evaluation completes, note its evaluation ID from the logs or from the Vijil Console.
2

Build Guardrails From the Evaluation

Dome.create_from_vijil_evaluation fetches the recommended configuration for that evaluation and returns a ready-to-use Dome:
Wrap your Agent so every request passes through the tuned Guardrails:
Re-run the evaluation against the protected Agent:
3

Optimize for Latency

Pass a latency_threshold (in seconds) to bias the recommendation toward faster Guards:
In code, the same argument is available on the factory:

Troubleshooting

Some Windows antivirus tools flag Ngrok. Ngrok is safe, and Vijil guarantees that traffic reaching your Agent through Ngrok originates only from Vijil services, so your Agent is never publicly exposed.

Next Steps

Configure Guardrails

Fine-tune the recommended configuration

Understand Results

Read the evaluation that drives the configuration
Last modified on July 16, 2026