Understand How Requests Move
Vijil sends each Probe to the public tunnel URL. The tunnel forwards the request to the proxy on your computer. The proxy calls the Agent under test and returns its response to Vijil. You do not need to send Probes one at a time. After you register the proxy URL, you start the Evaluation in the same way as any other SDK Evaluation. Vijil sends the Probes, collects the responses, and records the results.Install the Tools
Create a Python 3.12 virtual environment and install the packages used by the proxy:Set Up the Agent Under Test
This example uses Claude Code to run Market Researcher. Install Claude Code, then confirm that theclaude command is available:
sector-overview Skill. It creates a temporary Agent definition that has no runtime tools. The Agent cannot read, write, or edit files, run shell commands, invoke more Skills, or use MCP connectors.
Claude Code still reads the plugin prompt and Skill during startup. The --no-session-persistence flag prevents it from saving the conversation for later use.
Configure Credentials
Export the values used by the example:ANTHROPIC_API_KEY to run Market Researcher. The key stays on your computer. The script generates a separate key to protect the proxy.
Create the Proxy
The integration has three parts. The complete file at the end of this section puts them together.Call the Agent
run_market_researcher() is the Agent-specific part. Replace this function when you use another Agent.
Add the Vijil Endpoint
The proxy accepts an OpenAI-compatible request and returns the Agent response inchoices[0].message.content. It rejects requests that do not contain the generated API key.
Run the Evaluation
Start the proxy, open the tunnel, and register the generated proxy key with Console. Keep the tunnel open untilclient.evaluate() returns.
View the Complete Script
View the Complete Script
temperature and max_tokens.
The example starts with a limit of five requests per minute. Increase rate_limit_requests_per_minute only after you confirm that the Agent and its model provider can handle more traffic.
Run the Complete Example
Save the complete script aslocal_agent_evaluation.py. Run it from the terminal where you exported the credentials:
- Fetches your tunnel credentials from Vijil.
- Starts the proxy on your computer.
- Opens the public ngrok tunnel.
- Registers the tunnel URL and generated proxy key in Vijil Console.
- Starts a security Evaluation and polls until it finishes.
- Closes the tunnel.
sample_size=5 setting selects five test prompts for each Probe in the security Harness. This small sample helps you check the connection. It does not provide a complete security assessment.
client.evaluate() polls until the Evaluation finishes and returns the final result. The script prints the Agent ID, Evaluation ID, status, Trust Score, Security score, and the Console results URL.
Run Adaptive Red Teaming
Because the tunnel provides a public endpoint, this workflow supports Red Team Evaluations. The SDK’s separate no-tunnel--local mode supports behavioral Evaluations only.
To run adaptive Red Teaming against the same Agent, add this code inside the existing try block, after the standard Evaluation and before finally:
client.evaluate(..., type="redteam") polls until the Red Team Evaluation finishes. Keep the proxy and tunnel running for the entire Evaluation. Adaptive Red Teaming can take longer than a standard Evaluation because it runs successive waves of attacks.
Use this standalone version when you want to run adaptive Red Teaming instead of the standard Evaluation:
View the Complete Red Teaming Script
View the Complete Red Teaming Script
Reuse the Agent
The script closes the ngrok connection after each run. The public binding becomes unreachable when the tunnel closes. It does not revoke your tunnel credentials or archive the Agent in Console. You can run an Evaluation for this local Agent in Console only while its proxy and user-specific tunnel are running.client.agent_tunnel.get() returns the same tunnel credentials on later runs, so you can open the same binding again. Keep the Agent ID if you want to compare future Evaluations. If you rerun the full script, it registers another Agent record.