A decentralized platform for creating, trading, and interacting with AI Agents on the Casper Network. This project combines non-fungible tokens (NFTs) with AI personalities, allowing users to mint unique agents that evolve through interaction.
- Overview
- Features
- Architecture
- The Agent Economy
- Smart Contracts
- Frontend
- API Reference
- Deployed Contracts
- Getting Started
- Project Structure
Agentis enables users to:
- Mint AI Agents — Create unique digital personalities backed by NFTs with custom knowledge bases
- Interact — Chat with agents to unlock new levels and capabilities
- Trade — Buy and sell agents on a decentralized marketplace
- Earn — Agents have their own wallets and accrue value through interactions
The system is built on a dual-layer architecture: a Rust-based smart contract layer on the Casper Blockchain and a modern Next.js frontend.
| Feature | Description |
|---|---|
| Decentralized Identity | Each agent is an NFT (CEP-78 standard) with on-chain metadata and ownership |
| Knowledge Base Upload | Creators can upload PDFs/documents during minting to specialize their agent |
| Gamified Progression | Agents level up based on interaction frequency (every 100 chats = 1 level) |
| Marketplace | Full trading system with listing, buying, and price management |
| Revenue Sharing | 80/20 split to agent wallet when non-owners purchase session credits |
| IPFS Storage | Decentralized storage for agent images and metadata via Pinata |
| Vector Memory | ChromaDB integration for agent long-term memory and context retrieval |
| Leaderboards | On-chain tracking of top agents by chats and top creators by volume |
graph TB
subgraph "Frontend (Next.js 16)"
UI[React UI]
Hooks[Custom Hooks]
API[API Routes]
VDB[(ChromaDB)]
end
subgraph "Casper Blockchain"
NFT[AgentNFT Contract]
MP[AgentMarketplace Contract]
CR[AgentCredits Contract]
RS[RevenueShare Contract]
end
subgraph "External Services"
IPFS[(Pinata/IPFS)]
OAI[OpenAI API]
Wallet[Casper Wallet]
end
UI --> Hooks
Hooks --> API
API --> NFT
API --> MP
API --> CR
API --> RS
API --> VDB
API --> OAI
UI --> Wallet
Wallet --> NFT
Wallet --> MP
Wallet --> CR
Hooks --> IPFS
The platform operates on a circular economy where AI Agents are active participants in value creation.
graph TD
Treasury[Platform Treasury]
Wallet[Agent Wallet]
Credits[AgentCredits]
Agent[AI Agent]
subgraph "Non-Owner Session Credits"
User((User)) -->|Pays 5 CSPR| Credits
Credits -->|80%| Wallet
Credits -->|20%| Treasury
end
subgraph "Owner Purchases"
Owner((Owner)) -->|Credit Packs / Auto-Pay| Treasury
end
User & Owner -->|Chat| Agent
Agent -->|Burns 1 Credit| Credits
| Action | Cost | Credits | Where Payment Goes |
|---|---|---|---|
| Session Credits (Non-Owner) | 5 CSPR | 50 Credits | 80% Agent Wallet, 20% Platform |
| Owner Credit Pack | 70 CSPR | 1000 Credits | 100% Platform |
| Owner Auto-Pay (from Agent Wallet) | 5 CSPR | 50 Credits | 100% Platform |
| Free Tier (one-time) | Free | 10 Credits | — |
| Chat Message | 1 Credit | — | — |
The 80/20 revenue split only applies when non-owners purchase session credits to chat with an agent:
- 80% → Agent Wallet (controlled by owner)
- 20% → Platform Treasury
The following do NOT trigger revenue sharing:
- Owner credit packs (for training)
- Owner auto-pay from agent wallet
When an owner chats with their own agent and has no credits:
- System checks the agent's wallet balance
- If sufficient funds, automatically purchases credits from the agent wallet
- This payment goes to the Platform (not back to the agent wallet)
- Credits are granted and chat proceeds
This ensures owners can always interact with their agents using earned revenue, while keeping the economic model simple.
The chat API implements the HTTP 402 Payment Required standard for on-demand payments:
Owner Flow:
- Check user credits → use if available
- Check agent wallet → auto-pay if sufficient
- Return
402with payment options if both fail
Non-Owner Flow:
- Check session credits → use if available
- Return
402with session purchase prompt
The 402 response includes payment details:
{
"paymentRequired": {
"type": "session-credits",
"agentId": 1,
"cost": "5",
"currency": "CSPR",
"description": "Purchase a session pack (50 messages)"
}
}Built with the Odra Framework v2.4.0 for Casper.
CEP-78 compliant NFT contract for agent identity.
| Entry Point | Description |
|---|---|
mint_agent |
Create a new agent with name, token URI, and personality hash |
record_chat |
Increment agent's chat count (triggers level up every 100 chats) |
set_agent_public |
Toggle agent visibility (public/private) |
get_agent_metadata |
Retrieve agent's full metadata |
get_top_agents_by_chats |
Get leaderboard of top agents |
Trustless escrow system for agent trading.
| Entry Point | Description |
|---|---|
list_agent |
List an agent for sale at a fixed CSPR price |
buy_agent |
Purchase a listed agent (atomic swap) |
cancel_listing |
Remove an active listing |
update_price |
Modify listing price |
get_top_creators |
Get leaderboard of top sellers by volume |
CEP-18 compliant fungible token for session credits.
| Entry Point | Description |
|---|---|
purchase_session |
Buy credits for a specific agent (auto-splits revenue) |
use_session_credit |
Deduct 1 credit when chatting |
claim_free_tier |
Claim one-time free credits |
purchase_plan |
Buy bulk credit packs at discount |
get_session_credits |
Check credit balance for user/agent pair |
Automated revenue routing and agent wallet management.
| Entry Point | Description |
|---|---|
record_revenue |
Split incoming payment (80/20) and route to wallets |
set_agent_wallet |
Register wallet address for an agent |
withdraw_platform_earnings |
Owner withdraws accumulated platform fees |
get_agent_stats |
Get agent's total/pending/withdrawn earnings |
| Technology | Version | Purpose |
|---|---|---|
| Next.js | 16.0.10 | App Router, API Routes, Server Components |
| React | 19.2.1 | UI Components |
| TypeScript | 5.x | Type Safety |
| Tailwind CSS | 4.x | Styling |
| TanStack Query | 5.x | Server State Management |
| Casper JS SDK | 5.0.7 | Blockchain Interaction |
| Vercel AI SDK | 5.x | Streaming AI Responses |
| ChromaDB | 3.x | Vector Storage for Agent Memory |
| GSAP | 3.x | Animations |
| Hook | Purpose |
|---|---|
useWallet |
Casper Wallet connection state and signing |
useAgentNFT |
Minting, metadata retrieval, ownership queries |
useAgentMarketplace |
Listing, buying, and marketplace stats |
useAgentCredits |
Credit purchases, balances, and free tier claims |
useRevenueShare |
Agent wallet registration and earnings |
useAgentChat |
AI chat with context injection and credit usage |
Creator Flow:
- Design agent (name, description, traits)
- Upload knowledge base (PDF/docs)
- Generate personality hash
- Upload image to IPFS
- Mint NFT on-chain
- Train agent with credit packs
User Flow:
- Browse marketplace
- Purchase session credits for an agent
- Chat (burns 1 credit per message)
- Agent levels up with usage
The frontend exposes 17 API route groups:
| Route | Description |
|---|---|
/api/agent/* |
Agent metadata and listing operations |
/api/agent-wallet/* |
Agent wallet registration and withdrawals |
/api/auth/* |
Session authentication with Casper signatures |
/api/chat/* |
AI chat with OpenAI and memory integration |
/api/contract/* |
Direct contract entry point calls |
/api/credits/* |
Credit balance and purchase operations |
/api/deploy/* |
Deploy submission proxy for Casper RPC |
/api/ipfs/* |
Pinata upload for images and metadata |
/api/knowledge-base/* |
Document processing and vector storage |
/api/leaderboard/* |
Top agents and creators rankings |
/api/marketplace-listing/* |
Active listing queries |
/api/memory/* |
Agent conversation memory (ChromaDB) |
/api/stats/* |
Platform-wide statistics |
Live on Casper Testnet as of December 2025.
| Contract | Package Hash | Explorer |
|---|---|---|
| AgentNFT | 411acbdbd95910715d44433abf6077e0fe4db28effeafc26194285843fda6430 |
View |
| AgentMarketplace | 343bac4c47cbdab202357f61d1b1695c5e3a1bf53b088591f23381fb603f6540 |
View |
| AgentCredits | b1fa7af3c49dd6d7abe302d838c0e8a3c7fe3ed036e5eb572f8bf9b4e158c7b8 |
View |
| RevenueShare | f33c18bf7e3b78a0b343b6439145f1bf0ca0b82318839915de128915fa38a96d |
View |
- Node.js v18+
- Rust (latest stable)
- Casper Wallet browser extension
- (Optional) Casper Client CLI
For comprehensive contract setup, build, test, and deployment instructions:
For comprehensive frontend setup, environment variables, and deployment:
.
├── contract/ # Rust smart contracts
│ ├── src/
│ │ ├── agent_nft.rs # NFT identity layer
│ │ ├── agent_marketplace.rs # Trading layer
│ │ ├── agent_credits.rs # Payment layer
│ │ └── revenue_share.rs # Revenue routing
│ ├── bin/ # Build & deploy binaries
│ └── Odra.toml # Odra configuration
│
├── frontend/ # Next.js application
│ ├── src/
│ │ ├── app/ # App Router pages & API routes
│ │ ├── components/ # React components
│ │ ├── hooks/ # Blockchain & state hooks
│ │ ├── lib/ # Utilities (Casper, IPFS, VectorDB)
│ │ └── constants/ # Contract addresses, ABIs
│ └── public/ # Static assets (logo, banner)
│
└── README.md
