# 05 AI agent architecture

Auvin Chain's defining characteristic compared to other Layer 2 blockchains is its AI-native technology stack. From on-chain identity registration to autonomous payment execution, from security constraint frameworks to multi-agent collaboration, Auvin Chain provides a complete infrastructure enabling AI Agents to operate as independent economic entities on-chain.

## 5.1 AI Agent On-Chain Identity System

On Auvin Chain, each AI Agent has an independent on-chain identity. This identity system is not simply a wallet address but a structured identity profile containing multi-dimensional attributes.

### Identity Registration Process

An AI Agent's creator (developer or organization) registers a new AI Agent through Auvin Chain's AgentRegistry contract. The process includes:

1. Submitting Agent metadata (name, version, functional description, developer information)
2. Setting Agent permission configuration (spending limits, contract allowlists, operation time windows)
3. Specifying Agent security policies (TEE remote attestation requirements, multi-sig guardian lists)
4. Staking a certain amount of AUV as a credibility bond

Upon completion, the Agent receives a unique on-chain ID (Agent ID) bound to the Agent's Smart Contract wallet.

### Table 5-1: AI Agent On-Chain Identity Attributes

| Attribute Category    | Fields            | Description                                |
| --------------------- | ----------------- | ------------------------------------------ |
| **Basic Info**        | agentId           | Unique on-chain identifier                 |
|                       | name / version    | Agent name and version number              |
|                       | developer         | Developer/organization address             |
| **Permission Config** | spendingCap       | Session spending limit (AUV)               |
|                       | contractWhitelist | List of permitted contract addresses       |
|                       | timeWindow        | Permitted operation time window            |
| **Security Policy**   | teeRequired       | Whether TEE execution environment required |
|                       | guardians         | Social recovery guardian addresses         |
|                       | stakeAmount       | Credibility bond quantity (AUV)            |
| **Runtime Status**    | status            | Active / Paused / Revoked                  |
|                       | totalTxCount      | Cumulative transaction count               |

### Identity Verification Mechanism

Each time an AI Agent initiates an operation, the system performs multi-layer verification:

1. **Identity validity check** — is the Agent registered and active
2. **Permission check** — is the operation within spending limits, is the target contract on the allowlist
3. **TEE attestation verification** — if policy requires TEE, verify the operation originates from a trusted execution environment
4. **Signature verification** — verify the operation's digital signature comes from the Agent's authorized key

Any layer failure automatically rejects the operation.

## 5.2 AI Agent Autonomous Payment Protocol

Auvin Chain implements an x402-protocol-compatible AI Agent autonomous payment interface, enabling AI Agents to independently complete end-to-end payment flows without human intervention.

### x402 Protocol Technical Architecture

x402 is an open payment protocol leveraging HTTP 402 status codes for machine-to-machine (M2M) payments. The technical flow:

{% stepper %}
{% step %}

### Service Request

AI Agent sends a request to the service provider's API (e.g., "invoke GPT-4 for text generation")
{% endstep %}

{% step %}

### 402 Response

Service provider returns HTTP 402 Payment Required response, containing: required ERC-20 token address, payment amount, recipient address, nonce (replay attack prevention)
{% endstep %}

{% step %}

### On-Chain Payment

AI Agent completes token transfer via Smart Contract wallet, generating a transaction hash
{% endstep %}

{% step %}

### Payment Proof

AI Agent submits the transaction hash to the service provider's verification endpoint
{% endstep %}

{% step %}

### Service Delivery

Service provider verifies on-chain payment and returns the requested API result
{% endstep %}
{% endstepper %}

### Auvin Chain's x402 Enhancements

Beyond standard x402, Auvin Chain adds:

* **Native Account Abstraction integration** — AI Agent payments execute through Smart Contract wallets supporting spending limits, contract allowlists, and other security policies
* **AUV token payment option** — in addition to USDC/USDT, supports AUV token payments with automatic partial burn post-payment
* **TEE signature protection** — payment signatures completed within TEE, preventing unauthorized payments from private key leakage
* **Batch payment support** — submit multiple payment requests in one transaction, reducing total gas costs

### AI Agent x402 Autonomous Payment Sequence

```
┌──────────┐    ┌──────────────────┐    ┌─────────────┐    ┌────────────────┐    ┌───────────┐
│ AI Agent │    │ Smart Contract   │    │Auvera Chain │    │Service Provider│    │ TEE Module│
└────┬─────┘    │     Wallet       │    └──────┬──────┘    └───────┬────────┘    └─────┬─────┘
     │          └──────────────────┘           │                   │                   │
     │                                         │                   │                   │
     │  1. API Request                         │                   │                   │
     ├────────────────────────────────────────────────────────────►│                   │
     │                                         │                   │                   │
     │  2. HTTP 402 Response                   │                   │                   │
     │◄────────────────────────────────────────────────────────────┤                   │
     │                                         │                   │                   │
     │  3. Request payment signature           │                   │                   │
     ├─────────────────────────────────────────────────────────────────────────────────►│
     │                                         │                   │                   │
     │                                         │                   │    4. Validate    │
     │                                         │                   │       spending    │
     │                                         │                   │       limit       │
     │                                         │                   │◄──────────────────┤
     │                                         │                   │                   │
     │                                         │    5. Sign tx     │                   │
     │                                         │    in TEE         │                   │
     │                                         │◄──────────────────┤                   │
     │                                         │                   │                   │
     │                                         │  6. Execute       │                   │
     │                                         │     on-chain      │                   │
     │                                         │     transfer      │                   │
     │                                         ├──────────────────►│                   │
     │                                         │                   │                   │
     │                                         │  7. Payment       │                   │
     │                                         │     confirmation  │                   │
     │                                         ├──────────────────►│                   │
     │                                         │                   │                   │
     │  8. Deliver API result                  │                   │                   │
     │◄────────────────────────────────────────────────────────────┤                   │
```

## 5.3 AI Agent Security Constraint Framework

Auvin Chain designs a multi-layer security constraint framework for AI Agents, ensuring agents operate autonomously while not exceeding preset security boundaries.

### Layer 1: On-Chain Policy Enforcement

Hard constraints enforced through Smart Contracts:

* **Spending limits** — session caps, per-transaction caps, daily/weekly/monthly cumulative caps
* **Contract allowlists** — agents can only interact with pre-approved contracts
* **Time windows** — agents can only operate within specified time periods
* **Operation frequency limits** — preventing anomalously high-frequency operations
* **Fund isolation** — agent wallets are separate from developer wallets—developers cannot directly access agent funds

### Layer 2: TEE Hardware Isolation

AI Agent private keys and sensitive operations execute within TEE:

* **Private key generation and storage** — keys generated within TEE, never leaving TEE boundaries
* **Signing operations** — all transaction signatures completed within TEE, application layer can only request signatures without accessing private keys
* **Remote attestation** — on-chain contracts can verify whether code running in TEE is the expected version
* **Tamper-proof execution** — TEE-internal code and data are invisible to the OS, safe even if OS is compromised

### Layer 3: Multi-Sig Guardians (Social Recovery)

When an Agent exhibits abnormal behavior or the primary key is lost:

* Guardians (3–5 preset addresses) can jointly pause Agent operations
* A majority of guardian signatures can recover Agent wallet control
* Guardians can also upgrade Agent security policies (e.g., lowering spending limits)

### Layer 4: On-Chain Audit and Circuit Breaker

All Agent operations are permanently recorded on-chain:

* Every transaction's initiator, target contract, amount, and timestamp
* **Anomaly detection** — system monitors Agent behavior patterns, automatically triggering circuit breaker when anomalies are detected
* **Circuit breaker** — when an Agent's operation frequency or amount exceeds historical baselines by a certain threshold, Agent operations are automatically paused pending guardian review

## 5.4 AI Agent Application Scenarios

Auvin Chain's AI Agent technology stack supports the following core application scenarios:

### Scenario 1: Autonomous Trading Agent

AI Agents execute trading strategies on Auvin's Prediction Market autonomously based on real-time data analysis and prediction models. Agents can:

* Monitor real-time event data, social media sentiment, and odds changes in real time
* Automatically open, close, and adjust positions according to preset strategies
* Execute trades under TEE protection to prevent strategy leakage
* Autonomously manage trading funds through x402 protocol

This scenario directly serves Auvin's Prediction Market ecosystem, providing liquidity and generating trading volume.

### Scenario 2: Compute Scheduling Agent

AI Agents act as intelligent schedulers for the compute network, automatically matching compute supply and demand. Agents can:

* Monitor global compute supply (GPU type, performance, price, geographic location)
* Receive task requests from compute demanders (model training, inference, rendering)
* Automatically match optimal compute resources and negotiate prices
* Complete compute procurement payments through x402 protocol
* Monitor task execution quality and automatically settle

### Scenario 3: DeFi Strategy Agent

AI Agents execute automated DeFi strategies on Auvin's Ve(3,3) DEX. Agents can:

* Monitor yields and bribe rewards across liquidity pools
* Automatically allocate funds to highest-yield pools
* Participate in Gauge voting to maximize returns
* Automatically reinvest earnings through compounding strategies

### Scenario 4: Data Service Agent

AI Agents serve as decentralized data providers for other agents and DApps. Agents can:

* Crawl and clean real-time data in specific domains (event data, market data, weather data)
* Charge data consumers through x402 protocol
* Execute data processing within TEE to ensure data integrity
* Submit data to Smart Contracts through on-chain oracles


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://auverachain.gitbook.io/auvinchain/english/auvin-chain-collection/white-paper/05-ai-agent-architecture.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
