Skip to main content
Agent Evaluation provides three safety checkpoints for agentic AI systems: evaluate tool calls before execution, scan tool results before passing them back to the agent, and detect prompt injection in any text the agent is about to process. This is for systems where an AI agent can call tools (functions, APIs, retrieval) on its own. If your application only generates text, you can skip this and use Evaluation. If you build agents, these checkpoints guard the points where an agent can take or be influenced by an action.

The three checkpoints

Tool Call Evaluation

ALLOW / FLAG / BLOCK before a tool runs.

Tool Result Scanning

PII detection and injection check on tool output.

Prompt Injection Detection

Fast injection scan on any input text.
Integrate them in the order the agent runs: detect injection on incoming input first, evaluate a tool call before it executes, then scan the tool result before it returns to the agent. You can adopt one checkpoint or all three; if you start with one, prompt-injection detection on user input gives the broadest protection.

Quick example

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

What’s next

API Reference: Tool Call

Full specification for tool call evaluation.

Python SDK: Agent Evaluation

Python SDK reference for all three agent endpoints.