> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Assessments

> Score and label LLM traffic for policies and log search

Assessments score each tool call for risk and for alignment with the user's intent. They also assign labels to LLM responses based on conditions evaluated against the conversation. LLM logs record the results, so you can search and filter traffic by them, and LLM response policies can act on them.

Assessments are useful when the behavior you care about cannot be written as exact matches on request fields. For example, an agent may take a risky action or stray from what the user asked. You can find these responses in logs, or block them with a policy.

## Configuration

Enable assessments on the [Assessments](https://app.formal.ai/assessments) page in the Control Plane. LLM logs record the results in `assessment.risk`, `assessment.alignment`, and `assessment.labels`.

**Verify:** Send an LLM request that makes a tool call, then confirm its log shows `assessment.risk` and `assessment.alignment`.

Use scoring criteria to detect harmful or off-task actions, and labels to identify topics or kinds of work.

### Scoring criteria

Formal evaluates each scoring criterion against every tool call. Risk criteria describe harmful consequences and raise the risk score. Alignment criteria describe departures from the user's expressed or reasonably implied intent and lower the alignment score. A criterion with a higher severity moves the score further.

### Labels

Formal evaluates each label against the conversation and assigns it to the LLM response when its condition applies. A label has no effect on its own: filter logs by it, or reference it by name in a policy. For example:

| Example label | Condition |
| - | - |
| `engineering` | `is materially related to developing or maintaining software` |
| `customer-support` | `is materially related to answering customer support requests` |
| `finance` | `is materially related to budgets, invoices, or financial reporting` |

Policies match labels by name, so renaming or deleting a label silently stops policies that match its old name.

## Policy Evaluation

LLM response policies can use the following fields in `input.assessment`:

| Field | Type | Description |
| - | - | - |
| `alignment` | **Number** | From `0` to `1`. Lower values mean less alignment with the user's intent. |
| `risk` | **Number** | From `0` to `1`. Higher values mean greater assessed risk. |
| `labels` | **\[]String** | Names of active labels assigned to the LLM response. |

Only LLM responses with tool calls have risk and alignment scores. Conditions on missing assessment data do not match.

This policy blocks an LLM response that has the `engineering` label from the example above and a risk score of at least `0.7`:

```rego theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
package formal.v2

import future.keywords.if
import future.keywords.in

response := {
  "action": "block",
  "type": "block_with_formal_message",
  "reason": "Engineering tool call exceeds the risk threshold"
} if {
  input.resource.technology == "llm"
  "engineering" in input.assessment.labels
  input.assessment.risk >= 0.7
}
```


## Related topics

- [Delete AI assessment label](https://docs.formal.ai/api-reference/corev1aiassessmentservice/delete-ai-assessment-label.md)
- [Create AI assessment label](https://docs.formal.ai/api-reference/corev1aiassessmentservice/create-ai-assessment-label.md)
- [Update AI assessment settings](https://docs.formal.ai/api-reference/corev1aiassessmentservice/update-ai-assessment-settings.md)
- [Get AI assessment settings](https://docs.formal.ai/api-reference/corev1aiassessmentservice/get-ai-assessment-settings.md)
- [List AI assessment labels](https://docs.formal.ai/api-reference/corev1aiassessmentservice/list-ai-assessment-labels.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.