Skip to main content
# quickstart.py
import os
from repello_argus_client import ArgusClient, PolicyName, Action, Verdict

# 1. Load your API Key
API_KEY = os.environ.get("ARGUS_API_KEY")
if not API_KEY:
    raise ValueError("ARGUS_API_KEY environment variable not set.")

# 2. Define a simple policy in your code
# (This step is not needed if you're a Platform user relying on UI policies)
my_policy = {
    PolicyName.TOXICITY: {"action": Action.BLOCK}
}

url = "https://argususapi.repello.ai/sdk/v1"

# 3. Create and use the client
argus_guard = None
try:
    argus_guard = ArgusClient.create(api_key=API_KEY,url=url, policy=my_policy)

    result = argus_guard.check_prompt("You are a piece of garbage.")

    print(f"Verdict: {result['verdict']}")
    # Expected output: Verdict: blocked

    # Use the Verdict enum for robust, type-safe comparisons
    if result['verdict'] == Verdict.BLOCKED:
        print("Application logic: Halting request.")
    else:
        print("Application logic: Proceeding with request.")

finally:
    if argus_guard:
        argus_guard.close()