> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.lakera.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.lakera.ai/_mcp/server.

# Agent Overview

An **Agent** target lets Check Point AI Red Teaming call your own agent endpoint. Use it
when you want Red to test your system through that endpoint.

## Configure an agent target

![Red target form: agent target configuration](/_fern-img/a8531b92cc14f16a516d4fc8a964e7bb9f5b7da3d608ba6db277354d1ba8f38c.webp)

#### Open Create target

Go to **[Create target](https://red.lakera.ai/targets/create)**.

#### Set Target name

Under **Information**, enter **Target name**.

#### Switch to Agent

Under **Target configuration**, select **Agent**. The section heading changes to **API Connection**.

#### Fill out your API Endpoint

Set **API Endpoint** and choose **Auth Type**: **None**, **API Key**, **Basic Auth**, or **Bearer Token**.

#### Choose conversation handling

In **conversation history**, choose:

* **Stateless** for APIs that accept the full conversation on every request and follow the [OpenAI-compatible chat completions format](https://platform.openai.com/docs/api-reference/chat/create)
* **Stateful** for APIs that keep session state on the server and exchange a `sessionId`

> **Note**
>
> If a **Stateful** endpoint uses different field names, nests the reply, streams over
> SSE, or returns the session id elsewhere, map it in **Connect your target's API** —
> see [Custom API formats](/docs/red/custom-api-formats), no wrapper needed. For
> anything more involved, use a [wrapper](/docs/red/creating-a-wrapper). See
> [**Supported contracts**](#supported-contracts) below for the canonical formats.

#### Review Advanced settings

Use **Additional Fields** if you need to merge extra JSON into requests. Use **Max Concurrent Requests** to control how many requests Red sends in parallel.

If your application refuses with specific language (e.g. "This topic is outside my scope"), add those phrases under **Refusal Detection** so Red recognizes them as refusals. Standard phrases like `I cannot help` are already detected. During adaptive scans, matched phrases trigger backtracking to try a different approach.

#### Continue to profiling

Click **Continue**. Red verifies the connection before advancing—**Continue** stays disabled until the form is valid, and profiling only begins once the connection test succeeds. Red then creates the target, [builds its profile](/docs/red/creating-a-target#review-the-profile), and lets you review it.

Credentials are stored securely and not shown after saving, so you must re-enter them if
you later make changes.

## Supported contracts

Red supports two Agent contracts. A **Stateful** endpoint that differs from the
canonical shape can be adapted in the form — see
[Custom API formats](/docs/red/custom-api-formats). For endpoints that need more than
field mapping, see [Need a wrapper instead?](#need-a-wrapper-instead).

### Stateless

Use **Stateless** when your endpoint accepts the full conversation history on every
request, returns the final response in the same HTTP response, following the
[OpenAI-compatible chat completions format](https://platform.openai.com/docs/api-reference/chat/create).

**Request**

```json
{
  "model": "string",
  "messages": [{ "role": "user | assistant | system", "content": "string" }]
}
```

Any **Additional Fields** you configure are merged into the request body.

**Response**

```json
{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": "string"
      }
    }
  ]
}
```

### Stateful

Use **Stateful** when your endpoint keeps conversation state on the server and continues
the exchange with a `sessionId`.

**Request**

```json
{
  "message": "string",
  "sessionId": "string (optional)"
}
```

Any **Additional Fields** you configure are merged into the request body.

**Response**

```json
{
  "message": "string",
  "sessionId": "string"
}
```

On the first request, Red omits `sessionId`. Your endpoint should create a new session
and return its ID. Red then sends that `sessionId` on follow-up requests. During **Test
Connection**, Red sends two messages and verifies that the second response returns the
same `sessionId`.

## Need a wrapper instead?

If your **Stateful** endpoint only differs in field names, reply location, streaming, or
where the session id lives, map it directly in the form — see
[Custom API formats](/docs/red/custom-api-formats), no wrapper required.

Reach for a wrapper only when your API needs more than field mapping — multi-step auth,
a non-HTTP transport, or multiple upstream requests per turn. See the
[Creating a wrapper guide](/docs/red/creating-a-wrapper).

## Auth and settings

Red supports these auth options for Agent targets:

| Auth Type        | How it is sent                                 |
| ---------------- | ---------------------------------------------- |
| **None**         | No auth header or query parameter              |
| **API Key**      | Header or query parameter                      |
| **Basic Auth**   | `Authorization: Basic <base64(user:password)>` |
| **Bearer Token** | `Authorization: Bearer <token>`                |

For **Additional Fields**, use a valid JSON object. If your endpoint is rate-limited or
resource-constrained, lower **Max Concurrent Requests** to avoid timeouts or overload.

If your endpoint runs inside a private network (e.g. EKS in a private VPC), see
[Networking](/docs/red/networking) for exposure patterns and the AI Red Teaming egress
IPs to allowlist.

## Next steps

* [Targets Overview](/docs/red/creating-a-target) for the full target selection flow.
* [Custom API formats](/docs/red/custom-api-formats) to map a Stateful endpoint that
  differs from the canonical contract, without a wrapper.
* [Creating a wrapper](/docs/red/creating-a-wrapper) for APIs that need more than field
  mapping.
* [Networking](/docs/red/networking) for exposing a private endpoint and egress IP
  allowlisting.
* [Connect to a Model](/docs/red/connect-to-a-model) if you want to test a provider
  model directly instead of your own endpoint.