---
title: "Test Policies And Guardrails"
method: POST
path: "/utils/test_policies_and_guardrails"
tags: ["utils"]
---

# Test Policies And Guardrails

`POST /utils/test_policies_and_guardrails`

Apply policies and/or guardrails to inputs (for compliance UI testing).

Use inputs_list for batch testing: each input is processed as a separate call so
per-input block/allow and errors are returned.

Use inputs for a single call (legacy).

## Request body

- TestPoliciesAndGuardrailsRequest — Request body for POST /utils/test_policies_and_guardrails.
  - `policy_names` string[], nullable — Policy names to resolve guardrails from
  - `guardrail_names` string[], nullable — Guardrail names to apply directly
  - `inputs_list` GenericGuardrailAPIInputs[] — List of GenericGuardrailAPIInputs; each item processed separately (for batch compliance testing).
    - `texts` string[]
    - `images` string[]
    - `tools` ChatCompletionToolParam[]
      - `type` union, required
        - 'function'
        - string
      - `function` ChatCompletionToolParamFunctionChunk, required
        - `name` string, required
        - `description` string
        - `parameters` object
        - `strict` boolean
      - `cache_control` ChatCompletionCachedContent
        - `type` 'ephemeral', required
    - `tool_calls` union
      - ChatCompletionToolCallChunk[]
        - `id` string, nullable, required
        - `type` 'function', required
        - `function` ChatCompletionToolCallFunctionChunk, required
          - `name` string, nullable
          - `arguments` string
          - `provider_specific_fields` object, nullable
        - `index` integer, required
      - ChatCompletionMessageToolCall[]
    - `structured_messages` union[]
      - union
        - ChatCompletionUserMessage
          - `role` 'user', required
          - `content` union, required
            - string
            - union[]
              - …
          - `cache_control` ChatCompletionCachedContent
            - `type` 'ephemeral', required
        - ChatCompletionAssistantMessage
          - `role` 'assistant', required
          - `content` union
            - string
            - union[]
              - …
          - `name` string, nullable
          - `tool_calls` ChatCompletionAssistantToolCall[], nullable
            - `id` string, nullable, required
            - `type` 'function', required
            - `function` ChatCompletionToolCallFunctionChunk, required
              - …
          - `function_call` ChatCompletionToolCallFunctionChunk
            - `name` string, nullable
            - `arguments` string
            - `provider_specific_fields` object, nullable
          - `reasoning_content` string, nullable
          - `cache_control` ChatCompletionCachedContent
            - `type` 'ephemeral', required
          - `thinking_blocks` union[], nullable
            - union
              - …
        - ChatCompletionToolMessage
          - `role` 'tool', required
          - `content` union, required
            - string
            - ChatCompletionTextObject[]
              - …
          - `tool_call_id` string, required
        - ChatCompletionSystemMessage
          - `role` 'system', required
          - `content` union, required
            - string
            - unknown[]
              - …
          - `name` string
          - `cache_control` ChatCompletionCachedContent
            - `type` 'ephemeral', required
        - ChatCompletionFunctionMessage
          - `role` 'function', required
          - `content` union, required
            - string
            - ChatCompletionTextObject[]
              - …
          - `name` string, required
          - `tool_call_id` string, nullable, required
        - ChatCompletionDeveloperMessage
          - `role` 'developer', required
          - `content` union, required
            - string
            - unknown[]
              - …
          - `name` string
          - `cache_control` ChatCompletionCachedContent
            - `type` 'ephemeral', required
    - `model` string, nullable
  - `request_data` object — Request context (model, user_id, etc.)
  - `input_type` 'request' | 'response' — Whether inputs are request or response
  - `agent_id` string, nullable — When set, call chat completion with this model/agent for each input and include the response in the result.

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/sea-lion/apis/litellm-api.md) · [All operations](https://skmtc.net/sea-lion/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/sea-lion/litellm-api/revisions/79928a3d37d3/schema)
