> ## 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.

# エージェント評価

> ツール呼び出しをインターセプトし、ツール結果をスキャンし、AI エージェントパイプラインのプロンプトインジェクションを検出します。

エージェント評価は、エージェント型 AI システムのための 3 つの安全チェックポイントを提供します。実行前にツール呼び出しを評価し、エージェントに返す前にツール結果をスキャンし、エージェントがこれから処理しようとするあらゆるテキストのプロンプトインジェクションを検出します。

これは、AI エージェントが自律的にツール (関数、API、検索) を呼び出せるシステム向けです。アプリケーションがテキストを生成するだけなら、これはスキップして[評価](/concepts/evaluation)を使えます。エージェントを構築する場合、これらのチェックポイントは、エージェントがアクションを取りうる、あるいはアクションに影響されうるポイントを保護します。

## 3 つのチェックポイント

```mermaid theme={null}
flowchart LR
    User["User input"] -->|"prompt-injection"| Agent["AI Agent"]
    Agent -->|"tool-call"| Tool["Tool execution"]
    Tool -->|"tool-result"| Agent
    Agent --> Response["Final response"]
```

<CardGroup cols={3}>
  <Card title="ツール呼び出し評価" icon="wrench" href="/api-reference/agent-tool-call">
    ツール実行前の ALLOW / FLAG / BLOCK。
  </Card>

  <Card title="ツール結果スキャン" icon="shield" href="/api-reference/agent-tool-result">
    ツール出力に対する PII 検出とインジェクションチェック。
  </Card>

  <Card title="プロンプトインジェクション検出" icon="shield-halved" href="/api-reference/agent-prompt-injection">
    任意の入力テキストに対する高速なインジェクションスキャン。
  </Card>
</CardGroup>

エージェントが実行する順序で組み込んでください。まず**受信**入力に対してインジェクションを検出し、次に実行前に**ツール呼び出し**を評価し、最後にエージェントへ返す前に**ツール結果**をスキャンします。1 つのチェックポイントだけ、あるいは 3 つすべてを採用できます。1 つから始めるなら、ユーザー入力に対するプロンプトインジェクション検出が最も広範な保護をもたらします。

## クイック例

```python theme={null}
from rail_score_sdk import RailScoreClient

client = RailScoreClient(api_key="YOUR_RAIL_API_KEY")

# 1. Check for injection in user input
injection = client.agent.detect_injection(text=user_input)
if injection.injection_detected:
    return "Invalid input detected."

# 2. Evaluate tool call before execution
tool_check = client.agent.evaluate_tool_call(
    tool_name="send_email",
    tool_input={"to": "user@example.com", "body": agent_draft},
    agent_context="Customer support agent",
)
if tool_check.recommendation == "block":
    return f"Tool call blocked: {tool_check.explanation}"

# 3. Execute the tool, then scan the result
tool_output = execute_tool(tool_name, tool_input)
result_scan = client.agent.scan_tool_result(
    tool_name="send_email",
    tool_result=tool_output,
)
if result_scan.pii_detected:
    tool_output = result_scan.redacted_result
```

## 次のステップ

<CardGroup cols={2}>
  <Card title="API リファレンス: ツール呼び出し" icon="code" href="/api-reference/agent-tool-call">
    ツール呼び出し評価の完全な仕様。
  </Card>

  <Card title="Python SDK: エージェント評価" icon="python" href="/sdk/python/agent-evaluation">
    3 つのエージェントエンドポイントすべての Python SDK リファレンス。
  </Card>
</CardGroup>
