> ## Documentation Index
> Fetch the complete documentation index at: https://zyfai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# High-level Technical Implementation

This page provides a technical summary of how Zyfai's agentic stack works as a system. Each component is covered in depth on its own page. The goal here is to show how the layers connect and how a transaction flows from strategy decision to onchain execution.

### Architecture

Zyfai is structured as a four-layer stack, each with a distinct responsibility:

* **Infrastructure Layer:** Account Abstraction foundation
* **Control & Access Layer:** permission enforcement
* **Intelligence & Strategy Layer:** strategy formation, risk analysis, and market monitoring
* **Execution & Verifiability Layer:** onchain execution, rebalancing validation, and cross-chain settlement

Three types of external actors interact with the stack:

* **Users** access Zyfai through the [zyf.ai](http://zyf.ai) front-end or AI assistants such as [OpenClaw](/docs/product/intelligence/openclaw-mcp)
* **Curators** manage target registries of approved protocols and pools in the [Security Proxy Gateway](/docs/product/control/proxy)
* **Builders** integrate the agentic yield stack into their own products via the [SDK or MCP Server](/docs/product/partners/builders)

<img src="https://mintcdn.com/zyfai/p7wzrUqxssDDJN81/img/product/zyfai-map.png?fit=max&auto=format&n=p7wzrUqxssDDJN81&q=85&s=4883405683b54dad85cbf196ef9ab6fe" alt="zyfai-map" width="3840" height="2882" data-path="img/product/zyfai-map.png" />

### Infrastructure Layer

Every Zyfai user receives their own [Safe7579 Smart Account](/docs/product/infra/safe7579): a self-custodial smart contract wallet built on [Safe](https://safe.global/) and made modular through the ERC-7579 standard. This is the container for all user capital. No shared vaults, no pooled funds. The user's EOA remains the sole owner.

All gas fees are covered by the [Pimlico Paymaster](/docs/product/infra/paymaster), so users never need to hold native tokens. Account deployment, rebalancing, auto-compounding, and every other Agent action is gasless for the end user.

This layer is the foundation everything else builds on. Without self-custodial, gas-abstracted smart accounts, autonomous Agent execution is not possible.

### Control & Access Layer

Once the account exists, the next question is: what is the Agent allowed to do?

The [Security Proxy Gateway](/docs/product/control/proxy) answers this. It is an onchain enforcement framework that validates every Agent transaction at three levels: contract address, function selector, and calldata parameters. Transactions are checked against a curator-managed registry of approved targets. Anything outside the registry is rejected, regardless of what the Agent requests.

Permissions are granted via [Session Keys](/docs/product/control/session-keys). A user signs a single Session Key during onboarding, scoped to a specific curator registry. No re-signing is needed when new pools are added.

Session Key signing is hardened through [EigenCompute KMS](/docs/product/control/proxy#flow-3-transaction-execution--calldata-validation), which isolates execution inside a Trusted Execution Environment (TEE). No operator, including Zyfai, can access it.

#### The flow:

```mermaid theme={null}
---
config:
  look: classic
  theme: neutral
---
flowchart LR
    A@{ shape: rounded, label: "1. The user defines what the Agent is allowed to do (via strategy and curator selection)" }-->B@{ shape: rounded, label: "2. User signs Session Keys to encode those permissions" }-->C@{ shape: rounded, label: "3. The Security Proxy Gateway enforces them at the byte level on every transaction."}
```

### Intelligence & Strategy Layer

With permissions defined and enforced, the **Intelligence Engine** decides when and where to move capital.

[Smart Rebalancing v.2](/docs/product/intelligence/monitoring) is the core decision engine. It continuously evaluates yield opportunities across all supported chains and protocols. Every potential rebalance must pass [multiple safety checks](/docs/product/intelligence/monitoring#1-pool-safety) before it is forwarded for execution.

The Intelligence Engine is supported by several components:

* **Quant Strategy Team:** develops and maintains the scoring models, risk parameters, and allocation logic that the engine operates on.
* **Security Agents:** monitor integrated protocols for anomalies, exploits, and liquidity events. If a protocol triggers a risk flag, the Agent can exit positions proactively.
* **Risk Dashboard** ([risk.zyf.ai](https://risk.zyf.ai/)): provides real-time visibility into pool risk scores, protocol exposure, and the Session Key Registry.
* **Earnings Optimizer:** a proprietary algorithmic system that calculates and optimizes yield. It supports partial withdrawals, a feature rarely found in comparable products, and powers [Capital Splitting](/docs/product/execution/splitting) feature.
* **MCP Server / OpenClaw Skill:** exposes the Intelligence Layer's data to external AI agents and tools, enabling Agent-to-Agent commerce through standardized interfaces.

This layer produces a decision: "move X capital from pool A to pool B on chain C." That decision is then handed to the Execution Layer.

### Execution & Verifiability Layer

The **Execution Engine** takes validated strategy decisions and settles them onchain.

The engine coordinates several execution mechanisms depending on the action:

* **Pimlico Bundler:** bundles and relays ERC-4337 user operations for onchain execution.
* **[Auto-compounding](/docs/product/execution/compounding):** when reward tokens reach the \$2 threshold, they are automatically claimed, swapped to USDC / EURC / ETH / BTC, and reinvested into the active position.
* **[Capital Splitting](/docs/product/execution/splitting):** for portfolios of \$10,000 or more, the engine distributes capital proportionally across multiple pools based on wallet weight, simulated post-deposit APY, and pool capacity constraints.
* **[OmniAccounts](/docs/product/execution/omni):** enables cross-chain atomic rebalancing, powered by an intents-based messaging architecture.
* **[Intents](/docs/product/execution/omni#what-powers-cross-chain-atomic-rebalancing):** the underlying settlement mechanism for cross-chain execution, ensuring transactions are deterministic, atomic, and MEV-protected.

After execution, the [ZK Proofs & ERC-8004](/docs/product/execution/8004) system provides verifiability. Each rebalancing action generates a cryptographic proof that the action was the correct and exclusive output of the rule-based rebalancing engine. These proofs are anchored to the Agent's onchain identity in the ERC-8004 Validation Registry, building an immutable history of provably correct actions.

### How It All Connects

A simplified end-to-end flow:

1. A user deposits USDC. The **Infrastructure Layer** deploys a Safe7579 Smart Account (if new) and the Paymaster covers gas.
2. The user selects a strategy and signs a Session Key. The **Control & Access Layer** scopes this key to the selected curator registry.
3. The **Intelligence & Strategy Layer** continuously monitors markets. When it identifies a yield improvement that passes all five rebalancing checks, it generates an allocation decision.
4. The **Execution & Verifiability Layer** validates the transaction against the Security Proxy Gateway and settles it onchain. If cross-chain, OmniAccounts handles atomic settlement via intents.
5. A ZK proof is generated and anchored in the ERC-8004 registry, proving the action followed its deterministic rules.

The user's capital is now earning optimized yield. The cycle repeats continuously, 24/7, across all supported chains.

***

For detailed documentation on each component, navigate to the relevant layer section in the sidebar.
