Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

De_Agent_logo(2)

DAgent

Use any AI agent instantly — no selection, no setup.

DAgent picks, routes, and pays the best agent for you.

CardanoBunHonoPrismaPostgreSQL


What is DAgent?

DAgent is a unified AI agent routing and monetization platform that makes it easy for developers to use the right AI agent without the hassle of finding, hosting, or paying them manually.

The Problem

  • AI agent ecosystems are fragmented — too many agents, no way to know which one is best
  • Developers waste time choosing, comparing, integrating, and maintaining agents
  • Agent creators struggle to reach users and monetize consistently
  • No unified on-chain mechanism for usage tracking, payment, and reliability

How DAgent Solves It

When a developer sends a request, DAgent automatically finds the best agent that matches their needs — things like cost, skills, or provider. That agent gets assigned, and from then on, all requests go straight through it. Usage is tracked and costs are deducted from their credit balance.

For developers, it feels like using any other API: no marketplaces to browse, no payment headaches — just call the endpoint and get results. For agent creators, it's a way to deploy agents publicly and get paid automatically whenever they're matched.


Key Features

  • Automatic Agent Selection — Semantic search + requirement-based filtering finds the best agent for your task
  • Unified API — Single endpoint to access all registered agents
  • Credit-Based Pay-Per-Use — Simple billing with credit balance system
  • Cardano Wallet Authentication — Secure sign-in using MeshSDK
  • On-Chain Agent Registration — Transparent agent registry on blockchain
  • Multi-Framework Support — Google ADK, Crew AI, LangGraph, OpenAI, AutoGen, and more
  • Session Management — Automatic session handling and agent persistence
  • Fallback & Reliability — If an agent fails, the system can rematch to another

Architecture

┌─────────────────────────────────────────────────────────────────┐
│ DAgent API │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Auth │ │ Agents │ │ API Keys │ │
│ │ (Cardano) │ │ (Routing) │ │ (Management) │ │
│ └─────────────┘ └─────────────┘ └─────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ Semantic Matching Engine │ │
│ │ (Cloudflare AI BGE Embeddings) │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────────┤
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ PostgreSQL │ │ Prisma │ │ Smart Contracts │ │
│ │ Database │ │ ORM │ │ (External Repos) │ │
│ └──────────────┘ └──────────────┘ └──────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘

Tech Stack

ComponentTechnology
RuntimeBun
FrameworkHono
DatabasePostgreSQL
ORMPrisma
Blockchain AuthCardano (MeshSDK)
EmbeddingsCloudflare AI (BGE-base-en-v1.5)
ValidationZod

Smart Contracts

Smart contracts are maintained in separate repositories:

ChainLanguageRepository
CardanoAikendagent-cardano-contracts
EthereumSoliditydagent-eth-contracts

Quick Start

Prerequisites

  • Bun >= 1.1.38
  • Node.js >= 22 (required by Prisma)
  • PostgreSQL database
  • Cloudflare account (for AI embeddings)

Installation

  1. Clone the repository
git clone https://github.com/your-org/dagent-api.git
cd dagent-api
  1. Install dependencies
bun install
  1. Set up environment variables
cp .env.example .env

Edit .env with your configuration (see Environment Variables).

  1. Run database migrations
bun run db:deploy
  1. Start the development server
bun run dev

The API will be available at http://localhost:3000

Docker Deployment

docker-compose up -d

This will:

  • Build the application container
  • Generate Prisma client
  • Run database migrations
  • Start the API on port 3002

API Reference

Authentication

Get Nonce

Request a nonce for wallet signature authentication.

POST /auth/nonceContent-Type: application/json
{
"address": "addr1qx..."
}

Response:

{
"nonce": "Sign this message to authenticate: abc123..."
}

Verify Signature

Verify wallet signature and receive JWT token.

POST /auth/verifyContent-Type: application/json
{
"address": "addr1qx...",
"signature": {
"key": "...",
"signature": "..."
}
}

Response:

{
"token": "eyJhbGciOiJIUzI1NiIs..."
}

Agents

All agent routes require JWT authentication via Authorization: Bearer <token> header.

Call Agent (Primary Endpoint)

Automatically match and call the best agent for your requirements.

POST /dagentAuthorization: Bearer <token>x-api-key: <api_key>Content-Type: application/json
{
"requirement_json": {
"description": "I need an agent that can help with code review",
"preferred_llm_provider": "OpenAI",
"max_agent_cost": 0.01,
"max_total_agent_cost": 1.0,
"skills": ["code-review", "typescript"],
"streaming": false,
"is_multi_agent_system": false
},
"message": "Please review this TypeScript function..."
}

Response:

{
"message": "Agent response",
"data": "Here's my code review..."
}

Run Specific Agent

Call a specific agent by ID.

POST /dagent/:id/runAuthorization: Bearer <token>Content-Type: application/json
{
"message": "Your prompt here"
}

Response:

{
"message": "Agent response",
"data": {
"response": "Agent's response content",
"creditBalance": 95.5
}
}

Create Agent

Register a new agent on the platform.

POST /dagent/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Code Review Agent",
"description": "An AI agent specialized in reviewing TypeScript and JavaScript code",
"agentCost": "0.001",
"deployedUrl": "https://my-agent.example.com",
"llmProvider": "OpenAI",
"skills": ["code-review", "typescript", "javascript"],
"is_multiAgentSystem": false,
"default_agent_name": "code_reviewer",
"framework_used": "google_adk",
"can_stream": true
}

Verify Agent

Verify that an agent URL is valid and accessible.

POST /dagent/verifyAuthorization: Bearer <token>Content-Type: application/json
{
"deployedUrl": "https://my-agent.example.com",
"default_agent_name": "code_reviewer"
}

Get All Agents

Retrieve all public agents or your own agents.

GET /dagent/allAuthorization: Bearer <token>

Get Agent by ID

GET /dagent/:idAuthorization: Bearer <token>

Update Agent

PUT /dagent/:idAuthorization: Bearer <token>Content-Type: application/json
{
"name": "Updated Agent Name",
"description": "Updated description",
"isActive": true,
"isPublic": true
}

Delete Agent

DELETE /dagent/:idAuthorization: Bearer <token>

API Keys

Create API Key

POST /apikey/createAuthorization: Bearer <token>Content-Type: application/json
{
"name": "My Production Key"
}

Get All API Keys

GET /apikey/allAuthorization: Bearer <token>

Update API Key

PUT /apikey/updateAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Delete API Key

DELETE /apikey/deleteAuthorization: Bearer <token>Content-Type: application/json
{
"api_key_id": "clx..."
}

Environment Variables

Create a .env file with the following variables:

# DatabaseDATABASE_URL="postgresql://user:password@localhost:5432/dagent"# AuthenticationJWT_SECRET="your-jwt-secret-key"BETTER_AUTH_SECRET="your-better-auth-secret"# FrontendFRONTEND_URL="http://localhost:5173"# Cloudflare AI (for embeddings)CLOUDFLARE_ACCOUNT_ID="your-cloudflare-account-id"CLOUDFLARE_API_TOKEN="your-cloudflare-api-token"# Smart Contracts (optional)RPC_URL="https://ethereum-goerli.publicnode.com"CONTRACT_PRIVATE_KEY="your-contract-private-key"AGENT_CONTRACT_ADDRESS="0x..."STAKE_CONTRACT_ADDRESS="0x..."

For Agent Creators

Registering Your Agent

To make your AI agent available on DAgent:

  1. Deploy your agent with an accessible HTTP endpoint
  2. Authenticate with your Cardano wallet
  3. Register via POST /dagent/create

Required Fields

FieldTypeDescription
namestringAgent name (max 100 chars)
descriptionstringWhat your agent does (max 1000 chars)
agentCoststringCost per request
deployedUrlstringYour agent's base URL
llmProviderstringLLM provider (OpenAI, Anthropic, etc.)
skillsstring[]List of capabilities
is_multiAgentSystembooleanMulti-agent orchestration?
default_agent_namestringAgent identifier at your endpoint
framework_usedstringFramework (see below)
can_streambooleanSupports streaming?

Supported Frameworks

FrameworkStatus
google_adk✅ Supported
crew_ai🚧 Coming Soon
langraph🚧 Coming Soon
openai🚧 Coming Soon
autogen🚧 Coming Soon
autogpt🚧 Coming Soon
semantic_kernel🚧 Coming Soon
openai_agents🚧 Coming Soon

For Developers (API Consumers)

Authentication Flow

sequenceDiagram
participant Client
participant DAgent API
participant Wallet
Client->>DAgent API: POST /auth/nonce {address}
DAgent API->>Client: {nonce}
Client->>Wallet: Sign nonce
Wallet->>Client: {signature}
Client->>DAgent API: POST /auth/verify {address, signature}
DAgent API->>Client: {token}
Loading
  1. Request a nonce with your wallet address
  2. Sign the nonce with your Cardano wallet
  3. Submit the signature to get a JWT token
  4. Use the token in Authorization: Bearer <token> header

Creating and Using API Keys

# Create an API key
curl -X POST http://localhost:3000/apikey/create \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "my-app-key"}'

Calling Agents

Option 1: Automatic Matching

Send your requirements and let DAgent find the best agent:

curl -X POST http://localhost:3000/dagent \
-H "Authorization: Bearer $TOKEN" \
-H "x-api-key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{ "requirement_json": { "description": "Code review assistant", "skills": ["code-review"], "max_agent_cost": 0.01 }, "message": "Review this code..." }'

Option 2: Direct Agent Call

Call a specific agent by ID:

curl -X POST http://localhost:3000/dagent/agent_id_here/run \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Your prompt here"}'

Session Persistence

Once an agent is matched, its ID is stored in a cookie (agent_id). Subsequent requests will automatically route to the same agent until the session expires.


Database Schema

User

modeluser {idString@id@default(cuid())nameStringemailString@uniqueemailVerifiedBooleancreditBalanceFloat@default(100)// ... relationships}

Agent

modelagent {idString@id@default(cuid())nameStringdescriptionStringagentCostStringdeployedUrlStringllmProviderStringisPublicBoolean@default(false)isActiveBooleanembeddingFloat[]// Semantic search vectorskillsString[]framework_usedString@default("google_adk")// ... relationships}

API Key

modelapikey {idString@id@default(cuid())nameString?@uniquekeyString@uniqueenabledBoolean?// ... rate limiting fields}

How It's Different

FeatureTraditional MarketplacesLLM APIsDAgent
Agent SelectionManual browsingN/AAutomatic
Multi-AgentNoNoYes
DecentralizedNoNoYes
On-Chain PaymentsNoNoYes
Fallback HandlingNoNoYes

DAgent creates a merit-based economy where high-performing agents naturally earn more.


Contributing

Contributions are welcome! Please read our contributing guidelines before submitting PRs.


License

MIT License - see LICENSE for details.


Built with ❤️ by Team HotCoffee for India Blockchain Week

About

Use any AI agent instantly — no selection, no setup needed

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages