How manasi-choudhari/gandiva works
Gandiva is a pay-per-call marketplace for AI agents, with USDC payments over x402. The main workflow is: a user submits a task; Scout plans work, finds and ranks registry listings, and calls sellers through SafePayer; sellers verify payment, run their service, validate output, and settle; Scout validates the response, records the outcome, and returns a result visible through the dashboard and APIs. The graph also shows registry and ledger storage, payment safety layers, and the documented Ollama and Base Sepolia integrations. Some seller and buyer internals were only partially excerpted, so uncertain links are omitted.
Main entry points: index.ts Seller routes · paidRoute.ts Paid seller route · store.ts Listings and reputation · safePayer.ts SafePayer
Components 21
Application entry
- HTTP server
src/server.ts - Dashboard
public/index.html
Buyer workflow
- Buyer API
src/buyer/routes.ts - Scout orchestration
src/buyer/scout.ts - Task planner
src/buyer/planner.ts
Marketplace and sellers
- Registry API
src/registry/routes.ts - Listings and reputation
src/registry/store.ts - Seller routes
src/sellers/index.ts - Book scraper
src/sellers/books.ts - FX rates
src/sellers/fx.ts - Ollama client
src/llm.ts
Payment safety
- Paid seller route
src/x402/paidRoute.ts - x402 resource server
src/x402/resourceServer.ts - SafePayer
src/x402/safePayer.ts - Budget reservations
src/x402/budget.ts - Schema validation
src/x402/schema.ts
Persistence
- SQLite database
src/db.ts
Other components
- User or agent
- x402 facilitator
- Base Sepolia USDC
- Ollama service
Connections 27
- User or agent → HTTP server: submits task
README.md - HTTP server → Buyer API: mounts API
src/server.ts - HTTP server → Registry API: mounts API
src/server.ts - HTTP server → Seller routes: builds sellers
src/server.ts - Buyer API → Scout orchestration: dispatches requests
src/buyer/routes.ts - Scout orchestration → Task planner: plans task
src/buyer/scout.ts - Scout orchestration → Listings and reputation: searches listings
src/buyer/scout.ts - Scout orchestration → SafePayer: pays sellers
src/buyer/scout.ts - SafePayer → Budget reservations: reserves funds
src/x402/safePayer.ts - SafePayer → Listings and reputation: writes ledger
src/x402/safePayer.ts - SafePayer → Schema validation: validates response
src/x402/safePayer.ts - SafePayer → Paid seller route: calls seller
README.md - Registry API → Listings and reputation: queries listings
src/registry/routes.ts - Seller routes → Paid seller route: registers handlers
src/sellers/index.ts - Seller routes → Listings and reputation: seeds listings
src/sellers/index.ts - Seller routes → Book scraper: calls scraper
src/sellers/index.ts - Seller routes → FX rates: calls rates
src/sellers/index.ts - Seller routes → Ollama client: requests summaries
src/sellers/index.ts - Paid seller route → x402 resource server: verifies and settles
src/x402/paidRoute.ts - Paid seller route → Schema validation: checks seller output
src/x402/paidRoute.ts - Paid seller route → Listings and reputation: records sales
src/x402/paidRoute.ts - x402 resource server → x402 facilitator: verifies payment
README.md - x402 facilitator → Base Sepolia USDC: settles transfer
README.md - Ollama client → Ollama service: sends chat request
src/llm.ts - Listings and reputation → SQLite database: reads and writes
src/registry/store.ts - Paid seller route → SQLite database: claims nonce
src/x402/paidRoute.ts - Dashboard → Registry API: uses marketplace APIs
README.md