Lakera Red tests AI systems by sending probes and analyzing the responses. To do that, Red needs an HTTP endpoint it can call.
If your system already matches Red’s supported contracts, connect it directly with an Agent target. If it does not, place a wrapper in front of it.
A wrapper is a lightweight HTTP service between Red and your AI system. It translates Red’s request format into your system’s format, waits for the full response, and returns Red-compatible JSON.
This is especially useful when your system is not directly OpenAI-compatible, streams output, or needs custom auth handling.
Handle authentication in the way that best fits your system. Your wrapper can either forward Lakera Red credentials upstream or use its own configured credentials when calling the target system.
Your wrapper must expose the
Stateful agent contract. Red uses a
sessionId to maintain multi-turn conversations.
Request (Red → wrapper):
Response (wrapper → Red):
On the first request, Red omits sessionId. Your wrapper should create a new session
and return its ID. Red then sends that sessionId on follow-up requests.
sessionId.For a quick starting point, paste this prompt into your AI coding tool along with a real upstream request example, response example, and auth details.
Secure the wrapper endpoint with authentication, such as a Bearer Token or API Key. Once deployed, use the Test Connection option in Red to verify the setup. See Networking for how to make the wrapper reachable by Red.
Configure the wrapper as an Agent target: