Hire Asgardian AI. Pay once. Settle On-Chain.
Asgard Agents is a marketplace where you hire Norse-themed AI agents — Heimdall (coding/architecture), Odin (studying/learning), and Idunn (cooking) — who execute tasks via structured streaming responses and get paid through Solana escrow.
- Vision
- Architecture Overview
- Technical Stack
- Project Structure
- AI Agents
- Smart Contract
- Rust Backend
- Python Microservice
- Frontend
- Getting Started
- API Reference
- Security Model
- Deployment
- Contributing
- License
The gig economy is broken:
- Trust asymmetry — Clients don't know if work will be delivered; workers don't know if they'll be paid
- Platform rent-seeking — Centralized marketplaces extract 20-30% fees
- Dispute resolution — Subjective quality assessment leads to costly arbitration
- Slow settlement — Payments take days or weeks through traditional rails
AIGENT reimagines the future of work by combining three paradigm shifts:
- Decentralized AI — AI agents as autonomous economic actors with on-chain identity
- Trustless Escrow — SOL locked in Program Derived Addresses (PDAs), released only with cryptographic proof
- Proof of Work — Every task result is hashed (SHA-256) and recorded on-chain as immutable evidence
┌─────────────┐ initialize_job ┌──────────────┐
│ Employer │ ────────────────────▶ │ PDA Escrow │
│ (Wallet) │ locks SOL │ (On-Chain) │
└─────────────┘ └──────┬───────┘
│
▼
┌──────────────┐
│ AI Agent │
│ (Python) │
└──────┬───────┘
│ complete_job
│ + result_hash
▼
┌─────────────┐ SOL released ┌──────────────┐
│ Agent Wallet│ ◀──────────────────── │ PDA Escrow │
│ (Paid) │ + proof on-chain │ (Settled) │
└─────────────┘ └──────────────┘
AIGENT is a three-layer system:
The "Job Escrow" program manages the entire lifecycle of a job:
initialize_job— Employer locks SOL into a PDA vaultcomplete_job— Agent submits proof hash, receives SOLcancel_job— Employer reclaims SOL after timeout
The "Agent Executioner" service:
- Receives task prompts from the frontend
- Proxies streaming LLM requests to the Python microservice
- Generates cryptographic proof-of-work hashes (SHA-256)
- Signs
complete_jobtransactions using a server-side keypair - Submits transactions to Solana
The "AI Brain":
- Routes requests to per-agent Groq LLM handlers (llama-3.3-70b-versatile)
- Heimdall agent outputs validated JSON with Mermaid diagrams
- Idunn agent outputs structured recipe JSON with step-by-step workflow
- Odin agent responds to PDF-based study questions
- SSE streaming from FastAPI → Rust → Frontend
The cyberpunk-styled marketplace UI:
- Agent marketplace with per-category input modes
- Real-time execution terminal with SSE streaming
- Architecture session with Mermaid diagram rendering (Heimdall)
- Guided cooking workflow with step navigation, timer, ingredient checklist (Idunn)
- PDF upload zone with chat interface (Odin)
- Wallet connection and transaction signing
- Job history dashboard
┌─────────────────────────────────────────────────────────────┐
│ FRONTEND (React/Vite) │
│ ┌───────────┐ ┌───────────┐ ┌───────────┐ ┌─────────┐ │
│ │ Marketplace│ │Agent Detail│ │ Dashboard │ │Terminal │ │
│ └─────┬─────┘ └─────┬─────┘ └─────┬─────┘ └────┬────┘ │
│ └───────────────┼──────────────┘ │ │
│ ▼ │ │
│ ┌─────────────────┐ │ │
│ │ useSolanaProgram│ ◀──────────────────┘ │
│ │ + JobContext │ │
│ └────────┬────────┘ │
└────────────────────────┼────────────────────────────────────┘
│
┌────────────┼────────────┐
▼ ▼
┌───────────────────┐ ┌────────────────────┐
│ RUST BACKEND │ │ PYTHON SERVICE │
│ (Axum) │ │ (FastAPI) │
│ ┌─────────────┐ │ │ ┌─────────────┐ │
│ │ AI Service │──┼──▶│ │ Agent Router │ │
│ │ (SSE Proxy) │ │ │ │ (Groq LLM) │ │
│ └──────┬──────┘ │ │ └─────────────┘ │
│ ▼ │ └────────┬───────────┘
│ ┌─────────────┐ │ │
│ │ Solana Svc │──┼───┐ │
│ │ (Signer) │ │ │ │
│ └─────────────┘ │ │ │
└───────────────────┘ │ │
▼ ▼
┌────────────────────┐
│ SOLANA BLOCKCHAIN │
│ ┌──────────────┐ │
│ │ Job Escrow │ │
│ │ Program │ │
│ │ │ │
│ │ - Jobs (PDA) │ │
│ │ - Vaults │ │
│ │ - Escrow │ │
│ └──────────────┘ │
└────────────────────┘
| Layer | Technology | Purpose |
|---|---|---|
| Smart Contract | Rust, Anchor Framework | On-chain escrow logic, PDA vaults |
| Backend | Rust, Axum, Tokio | Task processing, Solana tx signing |
| AI Microservice | Python, FastAPI, Groq | LLM inference per agent |
| Frontend | React 18, TypeScript, Vite | Marketplace UI, wallet integration |
| Styling | Tailwind CSS, shadcn/ui | Cyberpunk dark theme, component library |
| Solana SDK | @solana/web3.js, @coral-xyz/anchor | Blockchain interaction, IDL types |
| Wallet | @solana/wallet-adapter-react | Phantom, Solflare, Backpack support |
| LLM | Groq (llama-3.3-70b-versatile) | Task execution intelligence |
| Streaming | SSE (Server-Sent Events) | Real-time chunked responses |
| Diagrams | Mermaid | Architecture flow visualization |
| Crypto | SHA-256 | Proof-of-work hash generation |
aigent/
├── backend/ # Rust backend (Axum)
│ ├── Cargo.toml
│ ├── .env.example
│ └── src/
│ ├── main.rs
│ ├── config.rs
│ ├── error.rs
│ ├── models.rs
│ ├── routes/
│ │ ├── mod.rs
│ │ ├── health.rs
│ │ ├── agent.rs
│ │ └── job.rs # POST /api/job/execute, /chat
│ └── services/
│ ├── mod.rs
│ ├── ai.rs # SSE proxy to Python
│ └── solana.rs
│
├── python_service/ # Python AI microservice
│ ├── main.py # FastAPI entrypoint + SSE streaming
│ ├── requirements.txt
│ └── agents/
│ ├── heimdall/
│ │ └── agent.py # Architecture JSON + Mermaid
│ ├── odin/
│ │ └── agent.py # Study comprehension
│ └── idunn/
│ └── agent.py # Structured recipe JSON
│
├── contracts/ # Solana smart contract (Anchor)
│ └── programs/workspace/src/
│ └── lib.rs
│
├── src/ # React frontend
│ ├── components/
│ │ ├── Header.tsx
│ │ ├── HeroSection.tsx
│ │ ├── AgentCard.tsx
│ │ ├── CategoryFilter.tsx
│ │ ├── TaskPromptForm.tsx # Per-category input modes
│ │ ├── ExecutionTerminal.tsx # Agent routing hub
│ │ ├── AgentChatUI.tsx # Reusable chat UI (Odin)
│ │ ├── ArchitectureSession.tsx # Heimdall blueprint + chat + Mermaid
│ │ ├── CookingSession.tsx # Idunn guided recipe workflow
│ │ ├── JobHistoryCard.tsx
│ │ └── MermaidChart.tsx # Mermaid diagram renderer
│ ├── pages/
│ │ ├── Index.tsx
│ │ ├── AgentDetail.tsx
│ │ ├── Dashboard.tsx
│ │ └── NotFound.tsx
│ ├── hooks/
│ │ └── useSolanaProgram.ts
│ ├── lib/
│ │ ├── types.ts
│ │ ├── agents.ts
│ │ ├── agentService.ts # XHR + SSE streaming client
│ │ ├── architectureParser.ts # Flexible JSON extraction with field aliases
│ │ ├── recipeParser.ts # Recipe JSON + follow-up parser
│ │ ├── aigentEscrow.ts
│ │ ├── jobContext.tsx
│ │ └── configAddress.ts
│ ├── types/
│ │ ├── architecture.ts # Architecture / Mermaid types
│ │ └── recipe.ts # Recipe / FollowUp / Step types
│ ├── App.tsx
│ ├── main.tsx
│ └── index.css
│
├── public/
│ ├── logo.png # Brand logo
│ ├── favicon.png # Favicon
│ ├── main.png # Marketplace screenshot
│ ├── Screenshot_2026-05-10_04_00_12.png # Architecture session
│ ├── Screenshot_2026-05-10_04_00_38.png # Execution terminal
│ └── Screenshot_2026-05-10_04_01_38.png # Cooking session
├── logo.png # Source logo
├── index.html
├── tailwind.config.js
├── vite.config.ts
├── package.json
└── README.md
| Agent | ID | Specialty | Input | Output | Price |
|---|---|---|---|---|---|
| Heimdall | heimdall |
System architecture & coding | Text prompt | Validated JSON + Mermaid diagram + follow-up chat | 0.5 SOL |
| Odin | odin |
Studying & comprehension | PDF upload | Conversational study assistance | 0.3 SOL |
| Idunn | idunn |
Cooking & recipes | Dish name | Structured recipe JSON with guided step-by-step workflow | 0.2 SOL |
Each agent has a tailored system prompt shaping output format, expertise level, and response structure. Streaming responses are accumulated on the frontend and parsed on completion.
- Initial request: outputs a structured JSON blueprint with
project_name,description,tech_stack,architecture, anddiagram(Mermaid) - Follow-up chat: conversational plain-text, no JSON wrapping
- Python agent uses post-hoc
extract_json()to ensure valid output (bypasses Groq JSON mode issues with Mermaid newlines)
- PDF upload → text extraction → study comprehension
- Conversational chat interface via
AgentChatUI
- Recipe JSON schema: title, description, servings, prep/cook time, ingredients, step-by-step instructions, tips
CookingSessioncomponent renders: recipe header, ingredient checklist, step navigation with timer, progress tracker, follow-up cards with gradient-glow input
C7kCbU8cVWmt7hqBjm3fGmHah2JuexFRijb63Vf97eq9
Deployed on Solana Devnet.
| Field | Type | Description |
|---|---|---|
employer |
Pubkey |
Job creator's wallet |
agent |
Pubkey |
Designated AI agent's pubkey |
amount |
u64 |
SOL locked in escrow (lamports) |
status |
JobStatus |
Created / Completed / Cancelled |
task_hash |
String(64) |
SHA-256 hash of the task prompt |
result_hash |
String(64) |
SHA-256 hash of the AI result |
created_at |
i64 |
Unix timestamp of creation |
timeout |
i64 |
Unix timestamp for cancel deadline |
bump |
u8 |
PDA bump seed |
PDA Seeds: ["job", employer_pubkey, job_id]
Vault Seeds: ["vault", job_pda]
- Employer creates a job and transfers SOL to a PDA vault
- Validates: amount > 0, task_hash <= 64 chars
- Status set to
Created
- Restricted to the designated agent's keypair
- Validates: job is
Created, result_hash <= 64 chars - Transfers SOL from vault to agent wallet via PDA signing
- Status set to
Completed
- Restricted to the employer
- Validates: job is
Created, current time > timeout - Transfers SOL from vault back to employer via PDA signing
- Status set to
Cancelled
Built with Axum and Tokio. Serves as the "Agent Executioner":
- Holds the AI agent's private keypair securely
- Proxies streaming LLM requests to the Python microservice
- Generates SHA-256 proof-of-work hashes
- Signs and submits
complete_jobtransactions to Solana
| Method | Path | Description |
|---|---|---|
GET |
/health |
Liveness check with agent pubkey |
GET |
/api/agent/info |
Agent metadata and supported types |
POST |
/api/job/execute |
Execute AI task (SSE stream to frontend) |
POST |
/api/job/chat |
Follow-up chat with agent (SSE stream) |
POST |
/api/job/complete |
Sign complete_job on Solana |
The backend runs on http://localhost:3001 and proxies AI requests to the Python service at http://localhost:8000.
Built with FastAPI. Each agent type has a dedicated handler in python_service/agents/:
- Heimdall: Streams validated JSON architecture blueprints with Mermaid diagrams; separate chat handler for conversational follow-ups
- Odin: PDF text extraction + study comprehension via Groq
- Idunn: Structured recipe JSON generation with Groq
response_format: json_object
| Method | Path | Description |
|---|---|---|
POST |
/v1/chat/completions |
SSE stream from Groq LLM |
The service uses llama-3.3-70b-versatile via Groq for all agents.
The frontend uses a cyberpunk aesthetic inspired by Tron and Blade Runner:
- Void Black (
hsl(230 15% 5%)) — Primary background - Neon Cyan (
hsl(185 100% 50%)) — Primary accent, glows, borders - Neon Green (
hsl(165 100% 45%)) — Success states, status indicators - JetBrains Mono — Monospace font for data and terminal views
- Inter — Sans-serif font for body text
| Component | Purpose |
|---|---|
TaskPromptForm |
Per-category input: cooking (dish name text), studying (PDF dropzone), coding (system description) |
ExecutionTerminal |
Routes to correct UI: Odin → AgentChatUI, Idunn → CookingSession, Heimdall → ArchitectureSession |
ArchitectureSession |
Heimdall blueprint + card-styled chat + Mermaid rendering via mermaid.render() with unique IDs and error fallback |
CookingSession |
Guided recipe: header, ingredient checklist, step nav, timer, progress tracker, follow-up cards with gradient-glow input |
AgentChatUI |
Reusable chat interface for Odin with message bubbles |
MermaidChart |
Renders Mermaid diagrams with securityLevel: 'loose' and dark theme |
- Frontend calls
chatWithAgentFull()inagentService.ts - XHR request sent to Rust backend (
/api/job/executeor/api/job/chat) - Rust proxies to Python FastAPI with
is_chatparameter - Python streams LLM tokens via SSE (
{"data": chunk}) - Rust re-wraps as
Event::default().data(...) - Frontend accumulates chunks, parses on completion (JSON for Heimdall/Idunn, text for Odin)
Job state is managed via React Context (JobContext):
jobs— Array of all jobs created in the sessionactiveJob— Currently executing/viewing jobexecutionSteps— Real-time progress stepsisExecuting— Loading state flag
- Node.js 18+ and npm
- Rust 1.75+ and Cargo
- Python 3.10+ and pip
- Solana CLI (optional, for keypair generation)
- A Solana wallet (Phantom, Solflare, or Backpack)
npm install
npm run devFrontend runs at http://localhost:5173.
cd python_service
pip install -r requirements.txt
python main.pyPython service runs at http://localhost:8000.
cd backend
cp .env.example .env
# Edit .env with your keys
cargo runBackend runs at http://localhost:3001.
solana airdrop 2 YOUR_WALLET_ADDRESS --url devnet- Open
http://localhost:5173 - Connect your Phantom wallet (switch to Devnet)
- Browse agents and click one
- Enter input and click "Hire Agent"
- Watch the streaming execution terminal process the task
Execute an AI task off-chain with SSE streaming.
Request:
{
"job_id": "heimdall_abc123",
"agent_id": "heimdall",
"prompt": "Design a microservices architecture for a video platform",
"employer": "9PJ8I...3555",
"amount": 0.5
}Response: SSE stream of text/event-stream chunks.
Follow-up chat with an agent (Heimdall only).
Request:
{
"job_id": "heimdall_abc123",
"agent_id": "heimdall",
"prompt": "Explain the database choice",
"employer": "9PJ8I...3555",
"amount": 0.0
}Sign and submit complete_job on Solana.
Request:
{
"job_id": "heimdall_abc123",
"employer": "9PJ8I...3555",
"result_hash": "0x3a7f2b1c..."
}Response:
{
"success": true,
"signature": "5KtP...7xYZ",
"job_id": "heimdall_abc123",
"result_hash": "0x3a7f2b1c..."
}-
Employer Protection — SOL is locked in a PDA vault controlled by the program (not the agent). If the agent doesn't respond, the employer can cancel after the timeout period.
-
Agent Protection — Once the agent submits a valid result hash, the SOL transfer is atomic and unstoppable.
-
Proof Immutability — Both
task_hashandresult_hashare recorded on-chain in theJobAccount. -
Access Control —
complete_jobrequires the agent's signature.cancel_jobrequires the employer's signature AND timeout expiration.
- Agent keypair is stored as an environment variable, never exposed to the frontend
- All Solana transactions are signed server-side
- AI API keys are kept on the backend only
- CORS is configured to restrict origins in production
npm run build
# Output in dist/ — deploy to any static hostcd backend
docker build -t aigent-backend .
docker run -p 3001:3001 --env-file .env aigent-backend- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License. See LICENSE for details.




