Skip to main content
Pre-execution verification for AI agents.

Overview

QWED Agent Verification provides:
  • Pre-execution checks before agents act
  • Budget enforcement to limit costs
  • Risk assessment for each action
  • Activity logging for audit trails

Registering an Agent

from qwed_sdk import QWEDClient

client = QWEDClient(api_key="qwed_...")

agent = client.register_agent(
    name="DataAnalyst",
    type="supervised",  # supervised, autonomous, trusted
    principal_id="user_123",
    permissions={
        "allowed_engines": ["math", "logic", "sql"],
        "blocked_tools": ["execute_code"],
    },
    budget={
        "max_daily_cost_usd": 100,
        "max_requests_per_hour": 500,
    }
)

print(agent["agent_id"])     # agent_abc123
print(agent["agent_token"])  # qwed_agent_xyz...

Verifying Actions

Before an agent executes an action:
decision = client.verify_action(
    agent_id="agent_abc123",
    action={
        "type": "execute_sql",
        "query": "SELECT * FROM users"
    },
    context={
        "conversation_id": "conv_xyz",
        "user_intent": "Get user list"
    }
)

if decision["decision"] == "APPROVED":
    execute_query(query)
elif decision["decision"] == "DENIED":
    print("Action blocked:", decision["error"])
elif decision["decision"] == "PENDING":
    request_human_approval()

Trust Levels

LevelValueDescription
UNTRUSTED0No autonomous actions
SUPERVISED1Low-risk autonomous
AUTONOMOUS2Most actions autonomous
TRUSTED3Full autonomy

Risk Assessment

Actions are assessed for risk:
RiskExamples
LOWread_file, database_read
MEDIUMsend_email, api_call
HIGHfile_write, database_write
CRITICALexecute_code, file_delete, DROP

Decision Matrix

Trust LevelLOW RiskMEDIUM RiskHIGH RiskCRITICAL Risk
0 (Untrusted)PENDINGDENIEDDENIEDDENIED
1 (Supervised)APPROVEDPENDINGDENIEDDENIED
2 (Autonomous)APPROVEDAPPROVEDPENDINGDENIED
3 (Trusted)APPROVEDAPPROVEDAPPROVEDAPPROVED

Budget Enforcement

# Check remaining budget
budget = client.get_agent_budget("agent_abc123")
print(budget)
# {
#   "cost": {"max_daily_usd": 100, "current_daily_usd": 45.50},
#   "requests": {"max_per_hour": 500, "current_hour": 123}
# }

Activity Logging

# Get agent activity
activity = client.get_agent_activity("agent_abc123", limit=10)
for entry in activity:
    print(f"{entry['timestamp']}: {entry['action_type']} -> {entry['decision']}")

Framework Integration

LangChain

from qwed_sdk.langchain import QWEDVerificationCallback

agent = initialize_agent(
    tools=[...],
    callbacks=[QWEDVerificationCallback(agent_id="agent_abc123")]
)

CrewAI

from qwed_sdk.crewai import QWEDVerifiedAgent

analyst = QWEDVerifiedAgent(
    role="Analyst",
    goal="Analyze data",
    agent_id="agent_abc123"
)