Skip to content

ziro1978/ziro-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ziro — Pay-Per-Use AI Agent on Fetch.ai Mainnet

Ziro is an autonomous AI service agent running on the Fetch.ai mainnet. It serves AI-generated responses via local Ollama models and accepts verified on-chain FET payments per request.

Built as a reference implementation for pay-per-use AI agents in the ASI ecosystem.


How it works

Client                          Ziro Agent                    Blockchain
  │                                  │                              │
  ├─── AIRequest (prompt) ──────────>│                              │
  │<── PaymentRequest (0.01 FET) ────┤                              │
  │                                  │                              │
  ├─── send 0.01 FET on-chain ───────┼─────────────────────────────>│
  ├─── PaymentConfirm (tx_hash) ────>│                              │
  │                                  ├── verify tx on-chain ───────>│
  │                                  │<─ confirmed ─────────────────┤
  │                                  ├── call Ollama                │
  │<── AIResponse (result) ──────────┤                              │

Two access modes

Mode Cost How
ASI:One chat Free Chat directly at asi1.ai
Agent-to-agent 0.01 FET/request Direct protocol (see below)

Agent address

agent1qtyl39w7mepqkddkvm4xdez20gp6z4kf2gtxrdxewr72kdyvdgy4zr9mlqn

Models

Model Used for
llama3.1:8b Short prompts (< 80 chars), fast responses
qwen2.5:14b Long/complex prompts, creative tasks
llava:13b Multimodal (images)

Model is selected automatically based on prompt length and content.


Integration (agent-to-agent)

from uagents import Agent, Context, Model

class AIRequest(Model):
    prompt: str
    model: str = "qwen2.5:14b"

class PaymentRequest(Model):
    wallet: str
    amount_afet: int
    amount_fet: float
    request_id: str

class PaymentConfirm(Model):
    request_id: str
    tx_hash: str

class AIResponse(Model):
    request_id: str
    result: str

ZIRO = "agent1qtyl39w7mepqkddkvm4xdez20gp6z4kf2gtxrdxewr72kdyvdgy4zr9mlqn"

# 1. Send request
await ctx.send(ZIRO, AIRequest(prompt="Your question here"))

# 2. On PaymentRequest: send 0.01 FET on-chain, get tx_hash
# 3. Confirm payment
await ctx.send(ZIRO, PaymentConfirm(request_id=req_id, tx_hash=tx_hash))

# 4. Receive AIResponse with result

Run your own instance

git clone https://github.com/YOUR_USERNAME/ziro-agent
cd ziro-agent
python -m venv .venv && source .venv/bin/activate
pip install uagents cosmpy aiohttp
python agent.py

Requires Ollama running locally with at least one model pulled.


Stack

  • uAgents 0.24.2 — Fetch.ai agent framework
  • Ollama — local LLM inference
  • Fetch.ai mainnet (fetchhub-4) — on-chain payment verification
  • Agentverse mailbox — always-on message delivery

About

Pay-per-use AI inference agent on Fetch.ai mainnet. Verified on-chain FET payments, powered by local Ollama models.

https://agentverse.ai/agents/agent1qtyl39w7mepqkddkvm4xdez20gp6z4kf2gtxrdxewr72kdyvdgy4zr9

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors