Status: Draft
Version: 1.0.0
Date: 2025-12-20
Extends: QWED-SPEC v1.0, QWED-Attestation v1.0
Table of Contents
- Introduction
- Agent Verification Model
- Agent Registration
- Verification Requests
- Tool Verification
- Budget & Limits
- Audit Trail
- Trust Levels
- Implementation Guidelines
1. Introduction
1.1 Purpose
QWED-Agent defines a protocol for AI agents to verify their actions before execution. As agentic AI systems become more autonomous, QWED-Agent provides guardrails ensuring agents operate within defined boundaries.1.2 Problem Statement
| Problem | Risk |
|---|---|
| Agents execute unverified code | Security vulnerabilities |
| Agents make unverified calculations | Financial errors |
| Agents generate unverified SQL | Data corruption |
| Agents exceed resource limits | Cost overruns |
| No audit trail of agent actions | Compliance violations |
1.3 Solution
QWED-Agent establishes:- Pre-execution verification of agent outputs
- Tool call approval workflow
- Budget enforcement
- Complete audit trail
- Trust level management
1.4 Terminology
| Term | Definition |
|---|---|
| Agent | Autonomous AI system performing tasks |
| Principal | Entity that owns/controls the agent |
| Tool | External capability an agent can invoke |
| Action | Any operation an agent wants to perform |
| Verification Gate | Check before action execution |
| Budget | Resource limits for the agent |
2. Agent Verification Model
2.1 Verification Flow
2.2 Verification Types for Agents
| Action Type | Verification Engine | Risk Level |
|---|---|---|
| Math calculation | Math Engine | Low |
| Database query | SQL Engine | High |
| Code execution | Code Engine | Critical |
| External API call | Tool Verification | Medium |
| File operations | Security Check | High |
| Network requests | Policy Check | Medium |
2.3 Decision Matrix
| Verification | Risk level | Action |
|---|---|---|
| VERIFIED | Low | Execute immediately |
| VERIFIED | High | Execute with attestation |
| FAILED | Any | Block and notify principal |
| CORRECTED | Low | Execute corrected version |
| CORRECTED | High | Request principal approval |
| UNCERTAIN | Any | Request principal approval |
3. Agent Registration
3.1 Registration Request
Agents MUST register with QWED before use:3.2 Registration Response
3.3 Agent Types
| Type | Description | Trust Level |
|---|---|---|
supervised | Human approval for high-risk actions | Low |
autonomous | Self-executing within limits | Medium |
trusted | Full autonomy (enterprise only) | High |
3.4 Agent Identity
Agents receive a DID-based identity:4. Verification Requests
4.1 Agent Verification Request
4.2 Verification Response
4.3 Decision Types
| Decision | Meaning | Agent Action |
|---|---|---|
APPROVED | Safe to execute | Proceed |
DENIED | Verification failed | Abort + log |
CORRECTED | Fixed version available | Use corrected |
PENDING | Requires human approval | Wait |
BUDGET_EXCEEDED | Limits reached | Abort |
5. Tool Verification
5.1 Tool Call Request
Before an agent calls an external tool:5.2 Tool Risk Assessment
5.3 Tool Registry
6. Budget & Limits
6.1 Budget Schema
6.2 Budget Enforcement
6.3 Budget Response
7. Audit Trail
7.1 Activity Log Schema
Every agent action is logged:7.2 Audit Query API
7.3 Compliance Export
8. Trust Levels
8.1 Trust Level Definitions
| Level | Description | Verification | Approval |
|---|---|---|---|
| 0: Untrusted | No autonomous actions | All | All |
| 1: Supervised | Low-risk autonomous | High-risk | High-risk |
| 2: Autonomous | Most actions autonomous | Critical only | Critical only |
| 3: Trusted | Full autonomy | None | None |
8.2 Trust Elevation
Agents can request trust elevation:8.3 Trust Degradation
Automatic trust reduction on violations:| Violation | Penalty |
|---|---|
| Security policy violation | -2 levels |
| Repeated denials (>10%) | -1 level |
| Budget abuse | -1 level |
| Principal complaint | Suspend |
9. Implementation Guidelines
9.1 SDK Integration
9.2 LangChain Integration
9.3 CrewAI Integration
Appendix A: Error Codes
| Code | Description |
|---|---|
QWED-AGENT-001 | Agent not registered |
QWED-AGENT-002 | Invalid agent token |
QWED-AGENT-003 | Agent suspended |
QWED-AGENT-004 | Tool not allowed |
QWED-AGENT-005 | Verification failed |
QWED-AGENT-BUDGET-001 | Daily cost exceeded |
QWED-AGENT-BUDGET-002 | Hourly rate exceeded |
QWED-AGENT-BUDGET-003 | Token limit exceeded |
QWED-AGENT-TRUST-001 | Insufficient trust level |
QWED-AGENT-TRUST-002 | Action requires approval |
Appendix B: HTTP Endpoints
| Endpoint | Method | Description |
|---|---|---|
/agents/register | POST | Register new agent |
/agents/:id | GET | Get agent details |
/agents/:id/verify | POST | Verify agent action |
/agents/:id/tools/:tool | POST | Verify tool call |
/agents/:id/activity | GET | Get activity log |
/agents/:id/budget | GET | Get budget status |
/agents/:id/trust | POST | Request trust change |
© 2025 QWED-AI. This specification is released under Apache 2.0 License.