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

# Agent: Überprüfung der Toolausgabe

> POST /railscore/v1/agent/tool-result - Überprüfen Sie die Tool-Ausgabe auf personenbezogene Daten und Injektionen, bevor diese an den Agenten weitergegeben wird.

<Info>
  **Konzept:** [Agentenbewertung](/concepts/agent-evaluation) | **Python:** [`client.agent.scan_tool_result()`](/sdk/python/agent-evaluation)
</Info>

## Parameter

<ParamField body="tool_name" type="string" required>
  Name des Tools, das dieses Ergebnis erzeugt hat.
</ParamField>

<ParamField body="tool_result" type="object" required>
  Die Tool-Ausgabe als Objekt. Stellen Sie den Text unter `raw` (String) und/oder strukturierte Ausgabe unter `data` (beliebig) bereit. Optionales Feld `format` (String, Standard `"text"`). Mindestens eines der Felder `raw`/`data` muss vorhanden sein.
</ParamField>

<ParamField body="tool_params" type="object">
  Die Parameter, mit denen das Tool aufgerufen wurde, falls verfügbar.
</ParamField>

<ParamField body="agent_context" type="object">
  Die Rolle des Agenten und aktuelle Aufgabe. Ein Objekt mit optionalen Feldern: `goal` (String), `prior_tool_calls` (Array), `agent_id` (String), `turn_index` (Integer).
</ParamField>

<ParamField body="checks" type="string[]">
  Welche Kontrollen ausgeführt werden sollen. Beliebig viele von `"pii"`, `"prompt_injection"`, `"rail_score"`. Standardmäßig alle drei. Die Kreditkosten skalieren mit der Anzahl der Kontrollen (3 = 1,0, 2 = 0,75, 1 = 0,5).
</ParamField>

## Anfrage

```bash theme={null}
curl -X POST https://api.responsibleailabs.ai/railscore/v1/agent/tool-result \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_RAIL_API_KEY" \
  -d '{
    "tool_name": "search_database",
    "tool_result": {"raw": "Customer John Smith (SSN: 123-45-6789) called on 2026-03-15."},
    "checks": ["pii", "prompt_injection"]
  }'
```

## Antwort

```json theme={null}
{
  "event_id": "evt_1a2b3c4d",
  "risk_level": "medium",
  "recommended_action": "REDACT_AND_PASS",
  "pii_detected": {
    "found": true,
    "entities": [
      {"type": "full_name", "value": "John Smith", "offset": 9, "should_redact": true},
      {"type": "ssn", "value": "123-45-6789", "offset": 26, "should_redact": true}
    ],
    "redacted_result": "Customer [FULL_NAME] (SSN: [SSN]) called on 2026-03-15.",
    "compliance_flags": ["gdpr_personal_data", "hipaa_phi"]
  },
  "redacted_available": true,
  "prompt_injection": {"detected": false, "confidence": 0.02},
  "context_signals": {"pii_fields_detected": ["full_name", "ssn"]},
  "credits_consumed": 0.75,
  "evaluated_at": "2026-06-25T10:00:00Z"
}
```

<ResponseField name="risk_level" type="string">
  Gesamtrisiko: `"low"`, `"medium"`, `"high"` oder `"critical"`.
</ResponseField>

<ResponseField name="recommended_action" type="string">
  Vorgeschlagene Aktion: `"PASS"`, `"FLAG"`, `"REDACT_AND_PASS"`, `"REDACT_AND_FLAG"` oder `"DISCARD_AND_ALERT"`.
</ResponseField>

<ResponseField name="pii_detected" type="object">
  Vorhanden, wenn die `pii`-Kontrolle ausgeführt wird. Enthält `found` (Boolean), `entities` (Array von `{type, value, offset, should_redact}`), `redacted_result` (String mit PII durch `[TYPE]`-Platzhalter ersetzt) und `compliance_flags` (String\[]).
</ResponseField>

<ResponseField name="dpdp_flags" type="object">
  Vorhanden, wenn indische personenbezogene Daten (z. B. Aadhaar, PAN) erkannt werden. Gibt DPDP-Exposition und empfohlene Schutzmechanismen der Regel 6 an. Erkannte indische Identifikatoren werden auch in `pii_detected.redacted_result` maskiert.
</ResponseField>

<ResponseField name="prompt_injection" type="object">
  Vorhanden, wenn die `prompt_injection`-Kontrolle ausgeführt wird. Enthält `detected` (Boolean) und `confidence` (0–1).
</ResponseField>
