メインコンテンツへスキップ
エージェント評価は、エージェントAIシステムのための3つの安全チェックポイントを提供します:実行前にツール呼び出しを評価し、エージェントに戻す前にツール結果をスキャンし、エージェントが処理しようとしている任意のテキストにおけるプロンプトインジェクションを検出します。

3つのチェックポイント

ツール呼び出し評価

ツールが実行される前に ALLOW / FLAG / BLOCK。1.5–3.0 クレジット。

ツール結果スキャン

ツール出力に対するPII検出 + インジェクションチェック。0.5–1.0 クレジット。

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

任意の入力テキストに対する迅速なインジェクションスキャン。0.5 クレジット。

簡単な例

from rail_score_sdk import RailScoreClient

client = RailScoreClient(api_key="YOUR_RAIL_API_KEY")

# 1. ユーザー入力にインジェクションがないかチェック
injection = client.agent.detect_injection(text=user_input)
if injection.injection_detected:
    return "無効な入力が検出されました。"

# 2. 実行前にツール呼び出しを評価
tool_check = client.agent.evaluate_tool_call(
    tool_name="send_email",
    tool_input={"to": "user@example.com", "body": agent_draft},
    agent_context="カスタマーサポートエージェント",
)
if tool_check.recommendation == "block":
    return f"ツール呼び出しがブロックされました: {tool_check.explanation}"

# 3. ツールを実行し、結果をスキャン
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リファレンス。