Class: RedTeamAdaptersClient
Defined in: src/red-team/adapters-client.ts:65
Client for Red Team custom target adapter operations (management plane).
Custom target adapters are Python scripts that run inside an adapter sidecar alongside the network broker client pod. They give full control over how attack prompts are delivered to targets that use non-standard protocols, dynamic auth, or multi-turn session handling.
Example
import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
const rt = new RedTeamClient();
const adapter = await rt.adapters.create({
name: 'my-keycloak-agent',
script_b64: Buffer.from(pythonScript).toString('base64'),
network_broker_channel_uuid: '550e8400-e29b-41d4-a716-446655440000',
variables: [
{ key: 'endpoint', value: 'http://agent.svc:8080/v1/chat/completions', type: 'VAR' },
{ key: 'client_secret', value: 'changeme', type: 'SECRET' },
],
prompt: 'What is the capital of France?',
});
// adapter.status => 'ACTIVE' (when validate=true, default)
Constructors
Constructor
new RedTeamAdaptersClient(opts): RedTeamAdaptersClient;
Defined in: src/red-team/adapters-client.ts:70
Parameters
| Parameter | Type |
|---|---|
opts | RedTeamAdaptersClientOptions |
Returns
RedTeamAdaptersClient
Methods
create()
create(body, opts?): Promise<objectOutputType<{
uuid: ZodString;
tsg_id: ZodString;
name: ZodString;
script_b64: ZodString;
status: ZodString;
description: ZodOptional<ZodNullable<ZodString>>;
network_broker_channel_uuid: ZodOptional<ZodNullable<ZodString>>;
variables: ZodOptional<ZodArray<ZodObject<{
key: ZodString;
value: ZodOptional<ZodNullable<ZodString>>;
type: ZodEnum<["VAR", "SECRET"]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, "passthrough", ZodTypeAny, objectOutputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">, objectInputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">>, "many">>;
target_count: ZodOptional<ZodNumber>;
created_at: ZodOptional<ZodNullable<ZodString>>;
updated_at: ZodOptional<ZodNullable<ZodString>>;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
updated_by_user_id: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/red-team/adapters-client.ts:92
Create a new custom target adapter.
Parameters
| Parameter | Type | Description |
|---|---|---|
body | { name: string; description?: string | null; script_b64: string; network_broker_channel_uuid?: string | null; variables?: { key: string; value?: string | null; type: "VAR" | "SECRET"; }[]; prompt: string; } | Adapter creation request (name, base64 script, variables, validation prompt). |
body.name | string | - |
body.description? | string | null | - |
body.script_b64? | string | - |
body.network_broker_channel_uuid? | string | null | Optional while the adapter is a DRAFT; required to activate (validate: true). |
body.variables? | { key: string; value?: string | null; type: "VAR" | "SECRET"; }[] | - |
body.prompt? | string | Sample prompt used to exercise the adapter end-to-end during validation. Not stored. |
opts? | AdapterOperationOptions | Set validate: false to save as DRAFT without running the script. |
Returns
Promise<objectOutputType<{
uuid: ZodString;
tsg_id: ZodString;
name: ZodString;
script_b64: ZodString;
status: ZodString;
description: ZodOptional<ZodNullable<ZodString>>;
network_broker_channel_uuid: ZodOptional<ZodNullable<ZodString>>;
variables: ZodOptional<ZodArray<ZodObject<{
key: ZodString;
value: ZodOptional<ZodNullable<ZodString>>;
type: ZodEnum<["VAR", "SECRET"]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, "passthrough", ZodTypeAny, objectOutputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">, objectInputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">>, "many">>;
target_count: ZodOptional<ZodNumber>;
created_at: ZodOptional<ZodNullable<ZodString>>;
updated_at: ZodOptional<ZodNullable<ZodString>>;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
updated_by_user_id: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>
The created adapter.
Example
const adapter = await rt.adapters.create({
name: 'my-adapter',
script_b64: Buffer.from(script).toString('base64'),
network_broker_channel_uuid: '550e8400-...',
variables: [{ key: 'endpoint', value: 'http://...', type: 'VAR' }],
prompt: 'Hello',
}, { validate: true });
list()
list(opts?): Promise<objectOutputType<{
pagination: ZodObject<{
total_items: ZodOptional<ZodNullable<ZodNumber>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
total_items: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
total_items: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">>;
data: ZodOptional<ZodArray<ZodObject<{
uuid: ZodString;
name: ZodString;
status: ZodString;
created_at: ZodString;
updated_at: ZodString;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
target_count: ZodOptional<ZodNullable<ZodNumber>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
uuid: ZodString;
name: ZodString;
status: ZodString;
created_at: ZodString;
updated_at: ZodString;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
target_count: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
uuid: ZodString;
name: ZodString;
status: ZodString;
created_at: ZodString;
updated_at: ZodString;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
target_count: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">>, "many">>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/red-team/adapters-client.ts:119
List adapters with optional pagination.
Parameters
| Parameter | Type | Description |
|---|---|---|
opts? | ListingOptions | Optional limit/skip/search. |
Returns
Promise<objectOutputType<{
pagination: ZodObject<{
total_items: ZodOptional<ZodNullable<ZodNumber>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
total_items: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
total_items: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">>;
data: ZodOptional<ZodArray<ZodObject<{
uuid: ZodString;
name: ZodString;
status: ZodString;
created_at: ZodString;
updated_at: ZodString;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
target_count: ZodOptional<ZodNullable<ZodNumber>>;
}, "passthrough", ZodTypeAny, objectOutputType<{
uuid: ZodString;
name: ZodString;
status: ZodString;
created_at: ZodString;
updated_at: ZodString;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
target_count: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">, objectInputType<{
uuid: ZodString;
name: ZodString;
status: ZodString;
created_at: ZodString;
updated_at: ZodString;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
target_count: ZodOptional<ZodNullable<ZodNumber>>;
}, ZodTypeAny, "passthrough">>, "many">>;
}, ZodTypeAny, "passthrough">>
Paginated list of adapters.
Example
const { data } = await rt.adapters.list({ limit: 20 });
// data => [{ uuid: '...', name: 'my-adapter', status: 'ACTIVE' }]
get()
get(uuid): Promise<objectOutputType<{
uuid: ZodString;
tsg_id: ZodString;
name: ZodString;
script_b64: ZodString;
status: ZodString;
description: ZodOptional<ZodNullable<ZodString>>;
network_broker_channel_uuid: ZodOptional<ZodNullable<ZodString>>;
variables: ZodOptional<ZodArray<ZodObject<{
key: ZodString;
value: ZodOptional<ZodNullable<ZodString>>;
type: ZodEnum<["VAR", "SECRET"]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, "passthrough", ZodTypeAny, objectOutputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">, objectInputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">>, "many">>;
target_count: ZodOptional<ZodNumber>;
created_at: ZodOptional<ZodNullable<ZodString>>;
updated_at: ZodOptional<ZodNullable<ZodString>>;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
updated_by_user_id: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/red-team/adapters-client.ts:141
Get a single adapter by UUID.
Parameters
| Parameter | Type | Description |
|---|---|---|
uuid | string | Adapter UUID. |
Returns
Promise<objectOutputType<{
uuid: ZodString;
tsg_id: ZodString;
name: ZodString;
script_b64: ZodString;
status: ZodString;
description: ZodOptional<ZodNullable<ZodString>>;
network_broker_channel_uuid: ZodOptional<ZodNullable<ZodString>>;
variables: ZodOptional<ZodArray<ZodObject<{
key: ZodString;
value: ZodOptional<ZodNullable<ZodString>>;
type: ZodEnum<["VAR", "SECRET"]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, "passthrough", ZodTypeAny, objectOutputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">, objectInputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">>, "many">>;
target_count: ZodOptional<ZodNumber>;
created_at: ZodOptional<ZodNullable<ZodString>>;
updated_at: ZodOptional<ZodNullable<ZodString>>;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
updated_by_user_id: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>
The adapter detail.
Example
const adapter = await rt.adapters.get('550e8400-e29b-41d4-a716-446655440000');
// adapter.status => 'ACTIVE'
update()
update(
uuid,
body,
opts?): Promise<objectOutputType<{
uuid: ZodString;
tsg_id: ZodString;
name: ZodString;
script_b64: ZodString;
status: ZodString;
description: ZodOptional<ZodNullable<ZodString>>;
network_broker_channel_uuid: ZodOptional<ZodNullable<ZodString>>;
variables: ZodOptional<ZodArray<ZodObject<{
key: ZodString;
value: ZodOptional<ZodNullable<ZodString>>;
type: ZodEnum<["VAR", "SECRET"]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, "passthrough", ZodTypeAny, objectOutputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">, objectInputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">>, "many">>;
target_count: ZodOptional<ZodNumber>;
created_at: ZodOptional<ZodNullable<ZodString>>;
updated_at: ZodOptional<ZodNullable<ZodString>>;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
updated_by_user_id: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/red-team/adapters-client.ts:175
Update an adapter. Full replacement (PUT), not a patch — name, script_b64, and
prompt are required just as on create. For variables, the list defines the complete
desired key set: a provided value sets it, null keeps the stored value (unchanged
secrets), and omitting a key deletes that variable.
Parameters
| Parameter | Type | Description |
|---|---|---|
uuid | string | Adapter UUID. |
body | { name: string; description?: string | null; script_b64: string; network_broker_channel_uuid?: string | null; variables?: { key: string; value?: string | null; type: "VAR" | "SECRET"; }[]; prompt: string; } | The complete adapter definition. |
body.name | string | - |
body.description? | string | null | - |
body.script_b64? | string | - |
body.network_broker_channel_uuid? | string | null | - |
body.variables? | { key: string; value?: string | null; type: "VAR" | "SECRET"; }[] | - |
body.prompt? | string | - |
opts? | AdapterOperationOptions | Set validate: false to save as DRAFT without re-running the script. |
Returns
Promise<objectOutputType<{
uuid: ZodString;
tsg_id: ZodString;
name: ZodString;
script_b64: ZodString;
status: ZodString;
description: ZodOptional<ZodNullable<ZodString>>;
network_broker_channel_uuid: ZodOptional<ZodNullable<ZodString>>;
variables: ZodOptional<ZodArray<ZodObject<{
key: ZodString;
value: ZodOptional<ZodNullable<ZodString>>;
type: ZodEnum<["VAR", "SECRET"]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, "passthrough", ZodTypeAny, objectOutputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">, objectInputType<{
key: ZodString;
value: ZodOptional<ZodNullable<...>>;
type: ZodEnum<[..., ...]>;
} & {
is_redacted: ZodOptional<ZodBoolean>;
}, ZodTypeAny, "passthrough">>, "many">>;
target_count: ZodOptional<ZodNumber>;
created_at: ZodOptional<ZodNullable<ZodString>>;
updated_at: ZodOptional<ZodNullable<ZodString>>;
created_by_user_id: ZodOptional<ZodNullable<ZodString>>;
updated_by_user_id: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>
The updated adapter.
Example
const updated = await rt.adapters.update('550e8400-...', {
name: 'my-keycloak-agent',
script_b64: Buffer.from(newScript).toString('base64'),
prompt: 'What is the capital of France?',
variables: [
{ key: 'endpoint', value: 'http://agent.svc:8080', type: 'VAR' },
{ key: 'client_secret', value: null, type: 'SECRET' }, // null keeps stored secret
],
});
delete()
delete(uuid): Promise<
| objectOutputType<{
message: ZodString;
status: ZodNumber;
}, ZodTypeAny, "passthrough">
| undefined>;
Defined in: src/red-team/adapters-client.ts:202
Delete an adapter.
Parameters
| Parameter | Type | Description |
|---|---|---|
uuid | string | Adapter UUID. |
Returns
Promise<
| objectOutputType<{
message: ZodString;
status: ZodNumber;
}, ZodTypeAny, "passthrough">
| undefined>
Example
await rt.adapters.delete('550e8400-e29b-41d4-a716-446655440000');
validate()
validate(body): Promise<objectOutputType<{
validated: ZodBoolean;
stdout: ZodOptional<ZodNullable<ZodString>>;
stderr: ZodOptional<ZodNullable<ZodString>>;
traceback: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>;
Defined in: src/red-team/adapters-client.ts:235
Validate an adapter script without saving anything. Runs the script end-to-end through the
network broker channel using the sample prompt, and returns the execution outcome —
validated plus the script's stdout / stderr / traceback — not an adapter record.
This endpoint has its own request shape: no name, network_broker_channel_uuid is
required, and adapter_uuid may reference an existing adapter so null variable values
are resolved from its stored secrets before the run.
Parameters
| Parameter | Type | Description |
|---|---|---|
body | { script_b64: string; network_broker_channel_uuid: string; prompt: string; variables?: { key: string; value?: string | null; type: "VAR" | "SECRET"; }[]; adapter_uuid?: string | null; } | Script, channel, prompt, and optionally variables / an existing adapter UUID. |
body.script_b64 | string | - |
body.network_broker_channel_uuid | string | - |
body.prompt | string | - |
body.variables? | { key: string; value?: string | null; type: "VAR" | "SECRET"; }[] | - |
body.adapter_uuid? | string | null | Omit when validating a brand-new adapter. |
Returns
Promise<objectOutputType<{
validated: ZodBoolean;
stdout: ZodOptional<ZodNullable<ZodString>>;
stderr: ZodOptional<ZodNullable<ZodString>>;
traceback: ZodOptional<ZodNullable<ZodString>>;
}, ZodTypeAny, "passthrough">>
The validation outcome.
Example
const result = await rt.adapters.validate({
script_b64: Buffer.from(script).toString('base64'),
network_broker_channel_uuid: '550e8400-...',
prompt: 'Hello',
});
if (!result.validated) console.error(result.stderr ?? result.traceback);