# System Architecture

### Runtime Overview

ZK-AgentMesh consists of the following primary components:

* **Agent Execution Layer**: Containerized AI agents hosted on decentralized compute ( Akash Network)
* **ZK Proof Layer**: Zero-knowledge circuits for verifying agent training quality, ethical compliance, and regulatory adherence without revealing private data.
* **Payment Layer**: A programmable revenue engine based on CDP Wallet (for revenue splits) and x402pay (for pay-per-call micropayments).
* **Registry & Indexer**: An on-chain registry of agent identities, verification proofs, payment configuration, and composability metadata.

***

### Onboarding Workflow

The onboarding of a new AI agent involves the following steps:

1. **Agent Registration**: Developer provides metadata, licensing, and initial commitments ( training standards, compliance goals).
2. **Training + Proof Generation**: Agent is trained on decentralized compute. During or post-training, the agent generates proofs using ZK circuits.
3. **Proof Submission**: Proofs ( quality, ethics, compliance) are submitted on-chain and linked to the agent's registry entry.
4. **Monetization Setup**: Developer configures x402pay pricing and CDP Wallet rev-share logic.
5. **Marketplace Listing**: Agent becomes discoverable in the ZK-AgentMesh interface, filterable by verification type, performance, and price.

***

### Proof Composition & Inheritance

Agents can inherit the verified capabilities of other agents by referencing their proofs:

* **Composable Proof Graph**: Agents build upon other agents' proofs, creating DAG-style logic pipelines.
* **Inheritance Metadata**: Each agent stores references to upstream proofs, allowing traceable logic chains.
* **Proof Royalty Model**: Original proof authors earn rewards when downstream agents reuse their guarantees.

***

### Compute Layer: Akash Integration

Training and inference are performed using Akash’s decentralized compute layer:

* **Permissionless Containers**: Developers deploy containerized agents using Akash SDL specs.
* **Trusted Enclave Execution**: Sensitive proof generation runs inside SGX for privacy.
* **Proof-Aware Inference**: Each agent container includes zk-runtime to continuously validate assertions.

***

### Payment Layer: x402pay + CDP Wallet

* **x402pay**: Wallet-native, per-call payment protocol. No need for subscriptions or logins. Agents charge per request.
* **CDP Wallet**: Revenue splitting system allowing programmable distribution among contributors ( trainer, verifier, host).

#### Example Flow:

* User sends request via frontend → Wallet signs + pays via x402pay
* Funds split on-chain using CDP Wallet tree → Contributors auto-paid
* Agent container on Akash returns result after verifying preconditions

***

### &#x20;Trust Registry and Discovery

ZK-AgentMesh maintains a decentralized index of verified agents:

* **Agent Identity**: Address-bound, includes metadata, verification level, registry tags.
* **Proof Record**: Stores hashes of ZK verification outcomes.
* **Filterable Discovery**: Users select agents by domain, proof level, cost, or upstream dependencies.

This composable registry acts as a **global trust layer** for agent-based intelligence.
