# AI Agents

zer0's AI agents are your personal digital workforce—autonomous, intelligent, and completely private. Running on-device with Llama-3-8B models, they execute complex workflows without ever exposing your data.

***

## 🤖 What Are zer0 AI Agents?

**AI agents** are specialized programs that combine large language models with task-specific tools to accomplish goals autonomously.

### Traditional AI (ChatGPT, Claude)

```
You: "Analyze my financial data"
↓
[Uploads to cloud server]
↓
OpenAI/Anthropic: Has your data forever
↓
AI: Returns analysis
```

### zer0 AI Agents

```
You: "Analyze my financial data"
↓
[Processes 100% locally on your device]
↓
AI Agent: Returns analysis
↓
Your data never left your computer
```

***

## 🎯 Built-In Agent Types

### 1. Research Agent 🔍

**Purpose:** Summarize articles, extract insights, answer questions privately

**Capabilities:**

* Scrape and summarize web pages
* Extract key facts from documents
* Answer questions based on context
* Generate research reports

**Example Use Cases:**

{% tabs %}
{% tab title="Article Summary" %}
**Task:** "Summarize this 10,000-word article on blockchain scaling"

**Agent Process:**

1. Fetches article via Tor
2. Extracts main points using NLP
3. Generates 300-word summary
4. Highlights key technical concepts

**Time:** \~15 seconds **Privacy:** No data sent to cloud
{% endtab %}

{% tab title="Multi-Source Research" %}
**Task:** "Compare DeFi yield strategies across 5 protocols"

**Agent Process:**

1. Queries protocol docs privately
2. Extracts current APY rates
3. Analyzes risk factors
4. Generates comparison table

**Time:** \~45 seconds **Privacy:** Tor routing, no tracking
{% endtab %}
{% endtabs %}

### 2. DeFi Agent 💱

**Purpose:** Private cryptocurrency operations and yield optimization

**Capabilities:**

* Execute shielded token swaps
* Optimize yield farming strategies
* Monitor portfolio across chains
* Alert on liquidation risks

**Example Use Cases:**

{% tabs %}
{% tab title="Yield Optimization" %}
**Task:** "Find best USDC yield under 0.01% risk"

**Agent Process:**

1. Scans 50+ DeFi protocols privately
2. Calculates risk-adjusted returns
3. Checks smart contract audits
4. Recommends top 3 options with proof

**Time:** \~30 seconds **Privacy:** zk-shielded queries
{% endtab %}

{% tab title="Private Swap" %}
**Task:** "Swap 1000 USDC → ETH privately"

**Agent Process:**

1. Finds best rate across DEXes
2. Generates zk-proof of funds
3. Executes swap via Tornado/Aztec
4. Receives ETH in shielded address

**Time:** \~2 minutes **Privacy:** Zero-knowledge throughout
{% endtab %}
{% endtabs %}

### 3. Data Agent 📊

**Purpose:** Analyze spreadsheets, visualize data, generate insights—all locally

**Capabilities:**

* Parse CSV/Excel files locally
* Statistical analysis (regression, clustering)
* Generate charts and visualizations
* Predictive modeling

**Example Use Cases:**

{% tabs %}
{% tab title="Financial Analysis" %}
**Task:** "Analyze my 2024 expenses and predict 2025"

**Agent Process:**

1. Loads CSV file locally
2. Categorizes expenses
3. Identifies trends and anomalies
4. Generates forecast with confidence intervals

**Time:** \~20 seconds **Privacy:** File never uploaded
{% endtab %}

{% tab title="Business Intelligence" %}
**Task:** "Visualize sales data and identify growth opportunities"

**Agent Process:**

1. Imports sales database locally
2. Generates interactive dashboards
3. Clusters customers by behavior
4. Recommends targeting strategies

**Time:** \~40 seconds **Privacy:** Completely on-device
{% endtab %}
{% endtabs %}

### 4. Social Agent 🌐

**Purpose:** Post anonymously to social media using zero-knowledge proofs

**Capabilities:**

* Anonymous posting to X (Twitter)
* Shielded Discord/Telegram messages
* Reputation without identity (Semaphore)
* Viral content distribution

**Example Use Cases:**

{% tabs %}
{% tab title="Anonymous Tweet" %}
**Task:** "Post a controversial opinion without linking to my identity"

**Agent Process:**

1. Generates zk-proof of humanness
2. Posts via Semaphore protocol
3. Tweet appears from anonymous account
4. Provably not a bot, but no identity

**Time:** \~10 seconds **Privacy:** Zero-knowledge identity
{% endtab %}

{% tab title="Whistleblowing" %}
**Task:** "Leak internal documents without exposing myself"

**Agent Process:**

1. Encrypts documents client-side
2. Uploads to decentralized storage
3. Shares link via anonymous identity
4. Verifies authenticity with zk-proof

**Time:** \~1 minute **Privacy:** Bulletproof anonymity
{% endtab %}
{% endtabs %}

### 5. Job Agent 💼

**Purpose:** Search jobs, tailor applications, automate outreach—privately

**Capabilities:**

* Scrape job boards without tracking
* Tailor resume/cover letter for each role
* Auto-apply to matching positions
* Track applications anonymously

**Example Use Cases:**

{% tabs %}
{% tab title="Job Search" %}
**Task:** "Find remote crypto jobs paying $150k+"

**Agent Process:**

1. Scrapes 20+ job boards via Tor
2. Filters by salary, location, keywords
3. Ranks by fit to your skills
4. Generates custom applications

**Time:** \~2 minutes **Privacy:** No recruiter tracking
{% endtab %}

{% tab title="Application Bot" %}
**Task:** "Apply to 50 roles with customized materials"

**Agent Process:**

1. Loads your resume template
2. Customizes for each job description
3. Generates unique cover letters
4. Auto-submits applications

**Time:** \~30 minutes (automated) **Privacy:** Disposable email per application
{% endtab %}
{% endtabs %}

***

## 🔧 How Agents Work

### Agent Architecture

```
┌─────────────────────────────────────────────────┐
│                  Agent Request                   │
│  "Optimize my DeFi yield across 50 protocols"  │
└───────────────────┬─────────────────────────────┘
                    │
                    ▼
┌─────────────────────────────────────────────────┐
│              Planning Module                     │
│  1. Break task into subtasks                    │
│  2. Determine tool requirements                 │
│  3. Generate execution plan                     │
└───────────────────┬─────────────────────────────┘
                    │
                    ▼
┌─────────────────────────────────────────────────┐
│           Execution Engine (Llama-3)            │
│  • Runs on-device (8B params)                   │
│  • Accesses tools via sandbox                   │
│  • Generates intermediate results               │
└───────────────────┬─────────────────────────────┘
                    │
                    ▼
┌─────────────────────────────────────────────────┐
│              Tool Ecosystem                      │
│  • Web scraper (Tor routing)                    │
│  • DeFi protocol connectors                     │
│  • Data analysis libraries                      │
│  • zk-Proof generators                          │
└───────────────────┬─────────────────────────────┘
                    │
                    ▼
┌─────────────────────────────────────────────────┐
│            Result & Verification                │
│  • Synthesize findings                          │
│  • Generate zk-proof of correctness             │
│  • Return to user                               │
└─────────────────────────────────────────────────┘
```

### On-Device Model: Llama-3-8B

**Why Llama-3-8B?**

* ✅ GPT-3.5 level performance
* ✅ Runs on consumer hardware (4GB RAM)
* ✅ Open-source and auditable
* ✅ Fast inference (20-50 tokens/sec)
* ✅ Specialized fine-tuning possible

**Optimizations:**

* **Quantization:** INT4 compression (4x smaller, faster)
* **KV Caching:** Reuse past computations
* **WebGPU Acceleration:** 5-10x speedup with GPU
* **Batching:** Process multiple requests efficiently

### Privacy Guarantees

**Every agent execution follows these principles:**

1. **Local-First Processing**
   * Models run on your device
   * No cloud API calls
   * Data never leaves your machine
2. **Tor-Routed Requests**
   * External queries via Tor
   * Randomized exit nodes
   * No IP leakage
3. **zk-Shielded Operations**
   * Blockchain interactions via zk-proofs
   * No transaction linkability
   * Privacy-preserving verification
4. **Memory Isolation**
   * Agents run in sandboxes
   * No cross-agent data sharing
   * Automatic memory wipe post-execution

***

## 🛍️ Agent Marketplace

### Rent Specialized Agents

Beyond built-in agents, access hundreds of community-created specialists:

| Category      | Examples                                  | Cost (avg)      |
| ------------- | ----------------------------------------- | --------------- |
| **DeFi**      | MEV Bot, Arbitrage Scanner, Whale Tracker | 5-20 $zer0/day  |
| **Social**    | Viral Content Generator, Engagement Bot   | 3-10 $zer0/day  |
| **Research**  | Academic Paper Analyzer, Patent Searcher  | 2-8 $zer0/day   |
| **Trading**   | Signal Bot, Portfolio Rebalancer          | 10-50 $zer0/day |
| **Dev Tools** | Code Reviewer, Bug Hunter, Doc Generator  | 5-15 $zer0/day  |

### Creating Custom Agents

**Developers can monetize specialized agents:**

```javascript
// Example: Custom DeFi Agent
const agent = new Zer0Agent({
  name: "APY Optimizer Pro",
  description: "Find best yields with risk analysis",
  price: "10 $zer0/day",
  
  async execute(task) {
    // Your custom logic
    const protocols = await scanDeFi();
    const analyzed = await riskAnalysis(protocols);
    return optimizeYield(analyzed, task.constraints);
  }
});

// Publish to marketplace
await agent.publish();
```

**Creator Economics:**

* **70%** to agent creator
* **20%** burned (deflationary)
* **10%** to zer0 DAO treasury

***

## 🚀 Advanced Agent Features

### 1. Agent Chaining

**Combine multiple agents for complex workflows:**

```
Task: "Research top AI projects, analyze tokens, and buy best 3"

Flow:
Research Agent → scrapes AI project data
       ↓
Data Agent → ranks by metrics
       ↓
DeFi Agent → executes private buys
       ↓
Result: Portfolio allocated automatically
```

### 2. Scheduled Agents

**Run agents on autopilot:**

```
Schedule: Every Monday 9 AM
Agent: DeFi Rebalancer
Task: "Rebalance portfolio to 60/30/10 ETH/BTC/Stables"
Notification: Slack/Email summary
```

### 3. Agent DAOs (Guilds)

**Pool resources for shared agents:**

* **DeFi Guild** - 1000 members share premium trading bots
* **Research Guild** - Academic paper analysis tools
* **Dev Guild** - Code review and security audit agents

**Benefits:**

* Split rental costs
* Shared insights (zk-anonymous)
* Governance over agent development

***

## 📊 Performance Benchmarks

### Agent Speed (Consumer Hardware)

| Agent Type   | Task                        | Time | Hardware           |
| ------------ | --------------------------- | ---- | ------------------ |
| **Research** | Summarize 5000-word article | 12s  | i5-12400, 8GB RAM  |
| **DeFi**     | Scan 50 protocols for yield | 28s  | i5-12400, 8GB RAM  |
| **Data**     | Analyze 10k-row CSV         | 18s  | i5-12400, 8GB RAM  |
| **Social**   | Generate + post tweet       | 8s   | i5-12400, 8GB RAM  |
| **Research** | Summarize article (GPU)     | 4s   | RTX 3060, 16GB RAM |
| **DeFi**     | Scan protocols (GPU)        | 11s  | RTX 3060, 16GB RAM |

### Accuracy Benchmarks

| Task Type            | Accuracy vs GPT-4 | Notes                         |
| -------------------- | ----------------- | ----------------------------- |
| **Summarization**    | 92%               | Slightly less nuanced         |
| **Data Analysis**    | 97%               | Math is math                  |
| **Code Generation**  | 85%               | Simpler patterns work well    |
| **Creative Writing** | 88%               | Less "personality"            |
| **Fact Extraction**  | 95%               | Excellent for structured data |

***

## 🔒 Security & Safety

### Agent Sandboxing

**Every agent runs in restricted environment:**

```
Allowed:
✅ Read user-approved files
✅ Network requests via Tor
✅ Execute code in VM
✅ Generate zk-proofs

Forbidden:
❌ Access other apps
❌ Persist data without consent
❌ Direct network access (bypass Tor)
❌ Access wallet without 2FA
```

### Agent Auditing

**All agent actions are logged locally:**

```
Agent: DeFi Optimizer
Time: 2025-08-03 14:30:22
Actions:
  - Fetched APY data from Aave (via Tor)
  - Analyzed risk metrics locally
  - Recommended: Move 1000 USDC to Aave V3
  
User Action: Approved
Result: Transaction 0x1234... (zk-shielded)
```

**You always see:**

* What data the agent accessed
* What actions it took
* What it recommended
* Final approval is always yours

***

## 💡 Use Case Examples

### Scenario 1: Privacy-Conscious Researcher

**Goal:** Research competitors without them knowing

```
1. Research Agent: "Analyze competitor.com's SEO strategy"
   → Scrapes via Tor (they see random IP)
   → Extracts keywords, backlinks, content
   → No trail back to you

2. Data Agent: "Compare their traffic to mine"
   → Loads your Analytics locally
   → Generates comparison report
   → Identifies opportunities

Result: Competitive intelligence with zero footprint
```

### Scenario 2: DeFi Yield Farmer

**Goal:** Maximize yield without constant monitoring

```
1. DeFi Agent (Scheduled Daily): "Find best stablecoin yield"
   → Scans 50+ protocols
   → Calculates gas costs
   → Recommends optimal pool

2. Auto-Execute (if enabled): Move funds to new pool
   → Generates zk-proof of ownership
   → Executes private swap
   → Deposits in recommended pool

Result: Passive 12% APY vs 6% manual
```

### Scenario 3: Anonymous Activist

**Goal:** Expose corruption without risking safety

```
1. Social Agent: "Post leaked documents anonymously"
   → Generates Semaphore identity (zk-proof of humanness)
   → Uploads docs to IPFS via Tor
   → Posts link on Twitter with zk-signature

2. Verification: "Prove I'm a real insider"
   → Generates zk-proof: "I have access to internal system"
   → Proves authenticity without revealing identity

Result: Information is public, whistleblower is safe
```

***

## 🎓 Learning More

### Agent Development

Want to build your own agents?

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Agent SDK Documentation</strong></td><td>Complete guide to building zer0 agents</td><td><a href="https://github.com/Onesignature/Zer0-gitbook/blob/main/developers/agent-sdk.md">https://github.com/Onesignature/Zer0-gitbook/blob/main/developers/agent-sdk.md</a></td></tr><tr><td><strong>Creating Custom Agents</strong></td><td>Tutorial: Build and monetize your first agent</td><td><a href="https://github.com/Onesignature/Zer0-gitbook/blob/main/developers/creating-agents.md">https://github.com/Onesignature/Zer0-gitbook/blob/main/developers/creating-agents.md</a></td></tr><tr><td><strong>Agent Marketplace Guide</strong></td><td>Discover and rent specialized agents</td><td><a href="https://github.com/Onesignature/Zer0-gitbook/blob/main/advanced/agent-marketplace.md">https://github.com/Onesignature/Zer0-gitbook/blob/main/advanced/agent-marketplace.md</a></td></tr></tbody></table>

***

{% hint style="success" %}
**Agents are the future of computing.** With zer0, that future is private, profitable, and in your control. 🤖
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://docs.zer0.build/core-concepts/ai-agents.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.
