メインコンテンツへスキップ
エージェント評価は、エージェント型 AI システムのための 3 つの安全チェックポイントを提供します。実行前にツール呼び出しを評価し、エージェントに返す前にツール結果をスキャンし、エージェントがこれから処理しようとするあらゆるテキストのプロンプトインジェクションを検出します。 これは、AI エージェントが自律的にツール (関数、API、検索) を呼び出せるシステム向けです。アプリケーションがテキストを生成するだけなら、これはスキップして評価を使えます。エージェントを構築する場合、これらのチェックポイントは、エージェントがアクションを取りうる、あるいはアクションに影響されうるポイントを保護します。

3 つのチェックポイント

ツール呼び出し評価

ツール実行前の ALLOW / FLAG / BLOCK。

ツール結果スキャン

ツール出力に対する PII 検出とインジェクションチェック。

プロンプトインジェクション検出

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

クイック例

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

次のステップ

API リファレンス: ツール呼び出し

ツール呼び出し評価の完全な仕様。

Python SDK: エージェント評価

3 つのエージェントエンドポイントすべての Python SDK リファレンス。