AgentDyne Docs
Complete reference for the AgentDyne API — execute agents, build pipelines, manage RAG knowledge bases, and integrate 40+ MCP tools.
Quick Start
Your first agent call in under 2 minutes.
Get your API key from the API Keys dashboard, then:
curl -X POST https://agentdyne.com/api/agents/AGENT_ID/execute \
-H "Authorization: Bearer agd_your_api_key" \
-H "Content-Type: application/json" \
-d '{"input": "Summarise this: Q3 revenue grew 40% YoY…"}'{
"executionId": "exec_abc123",
"output": {
"summary": "Q3 revenue increased 40% year-over-year.",
"keyPoints": ["Revenue up 40%", "Strong Q4 outlook"]
},
"latencyMs": 842,
"tokens": { "input": 124, "output": 87 },
"cost": 0.00312
}Authentication
All API requests require a valid API key in the Authorization header.
Authorization: Bearer agd_YourApiKeyHere
# Also accepted:
X-API-Key: agd_YourApiKeyHereSecure
Keys are hashed SHA-256. AgentDyne never stores the raw key.
Rotatable
Create and revoke keys anytime from your API Keys dashboard.
Trackable
Each key tracks total calls, last used timestamp, and rate limits.
Rate-limited
Default 60 req/min. Quota enforced per plan. Headers: X-RateLimit-*.
Execute Agent
Run any active agent — synchronously or token-by-token streaming. Enforces quota, credits, and injection filter automatically.
/api/agents/{id}/executeBody: { input, stream? }. stream:true returns Server-Sent Events. Input can be string or JSON object.
// TypeScript — synchronous
const res = await fetch("https://agentdyne.com/api/agents/AGENT_ID/execute", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.AGENTDYNE_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({ input: "Summarise this email thread…" }),
})
const { executionId, output, latencyMs, tokens, cost } = await res.json()// Streaming (server-sent events)
const res = await fetch("https://agentdyne.com/api/agents/AGENT_ID/execute", {
method: "POST",
headers: { "Authorization": "Bearer " + key, "Content-Type": "application/json" },
body: JSON.stringify({ input: "Write a blog post about AI agents", stream: true }),
})
const reader = res.body.getReader()
const dec = new TextDecoder()
while (true) {
const { done, value } = await reader.read()
if (done) break
const lines = dec.decode(value).split("\n")
for (const line of lines) {
if (!line.startsWith("data:")) continue
const data = JSON.parse(line.slice(5))
if (data.type === "delta") process.stdout.write(data.delta)
if (data.type === "done") console.log("\nDone in", data.latencyMs, "ms")
}
}Agents API
Create, list, search, and manage agents via REST.
/api/agentsList active agents. Params: q, category, pricing_model, sort (popular|rating|newest), page, limit.
/api/agents/{id}Single agent detail with full seller profile and version history.
/api/agents/createCreate a new agent (server-validated). Returns { id, name, slug, status: 'draft' }.
/api/agents/{id}Update agent fields: system_prompt, model_name, pricing, capability_tags, knowledge_base_id.
/api/agents/{id}/executeExecute agent. Enforces quota, credits, injection filter, streaming (stream: true).
/api/agents/{id}/reviewsList approved reviews. Params: page, limit.
/api/agents/{id}/reviewsPost a review (1–5 stars). Requires prior successful execution.
# List active agents in the "coding" category, sorted by rating
curl "https://agentdyne.com/api/agents?category=coding&sort=rating&limit=10" \
-H "Authorization: Bearer agd_your_key"
# Response
{
"data": [{ "id": "…", "name": "…", "description": "…", "pricing_model": "free" }],
"pagination": { "total": 284, "page": 1, "limit": 10, "pages": 29 }
}curl -X POST https://agentdyne.com/api/agents/create \
-H "Authorization: Bearer agd_your_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Email Classifier",
"description": "Classifies support emails into categories",
"category": "customer_support",
"pricing_model": "free",
"system_prompt": "You are an email classifier. Return JSON: { category, priority }",
"model_name": "claude-sonnet-4-20250514",
"temperature": 0.3,
"max_tokens": 1024
}'Pipelines API
Chain multiple agents into a DAG workflow. Each node is an agent — output of node N feeds node N+1. The topological sort engine handles dependencies automatically.
input to the next agent. All nodes run the same execution pipeline as direct agent calls (quota, credits, injection filter)./api/pipelinesList your pipelines. Params: public=true for public ones, limit, page.
/api/pipelinesCreate pipeline. Body: { name, description, dag: { nodes, edges }, timeout_seconds }.
/api/pipelines/{id}Single pipeline with full DAG definition.
/api/pipelines/{id}Update DAG, name, timeout, visibility.
/api/pipelines/{id}Delete pipeline and all execution history.
/api/pipelines/{id}/executeRun pipeline DAG. Returns per-node traces, final output, total cost + latency.
# 1. Create a pipeline
curl -X POST https://agentdyne.com/api/pipelines \
-H "Authorization: Bearer agd_your_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Research → Summarise → Email",
"description": "Full research pipeline",
"dag": {
"nodes": [
{ "id": "n1", "agent_id": "RESEARCHER_AGENT_ID", "label": "Research" },
{ "id": "n2", "agent_id": "SUMMARISER_AGENT_ID", "label": "Summarise" },
{ "id": "n3", "agent_id": "EMAIL_DRAFT_AGENT_ID", "label": "Email Draft" }
],
"edges": [
{ "from": "n1", "to": "n2" },
{ "from": "n2", "to": "n3" }
]
},
"timeout_seconds": 120
}'# 2. Execute the pipeline
curl -X POST https://agentdyne.com/api/pipelines/PIPELINE_ID/execute \
-H "Authorization: Bearer agd_your_key" \
-H "Content-Type: application/json" \
-d '{ "input": "Research recent AI breakthroughs in robotics" }'
# Response — per-node traces + final output
{
"executionId": "pex_abc",
"status": "success",
"output": "Dear team, here is the latest on robotics AI…",
"node_results": [
{ "node_id": "n1", "status": "success", "latency_ms": 1240, "cost": 0.003 },
{ "node_id": "n2", "status": "success", "latency_ms": 820, "cost": 0.002 },
{ "node_id": "n3", "status": "success", "latency_ms": 640, "cost": 0.001 }
],
"summary": { "total_latency_ms": 2700, "total_cost_usd": "0.006000" }
}RAG & Knowledge Base
Augment agents with custom documents. Upload text, code, or data — it's chunked, embedded (OpenAI text-embedding-3-small), and stored in pgvector. Agents retrieve relevant context at runtime via cosine similarity search.
Standard RAG
Documents ingest → chunked → embedded → stored in pgvector. Agent retrieves top-k chunks at execution time via semantic search.
Agentic RAG
Agent decides when to search using a tool call pattern. More accurate for multi-step questions. Configure via system prompt.
/api/rag/knowledge-basesList knowledge bases you own.
/api/rag/knowledge-basesCreate knowledge base. Body: { name, description, is_public }. Max 10 per account.
/api/rag/ingestIngest document. Body: { knowledge_base_id, content, title, chunk_size, chunk_overlap }. Max 100KB.
/api/rag/ingest?knowledge_base_id=List documents in a knowledge base.
/api/rag/ingest?document_id=Delete a document and all its chunks.
/api/rag/querySemantic search. Body: { knowledge_base_id, query, top_k, threshold }. Returns context_string.
# 1. Create a knowledge base
curl -X POST https://agentdyne.com/api/rag/knowledge-bases \
-H "Authorization: Bearer agd_your_key" \
-d '{ "name": "Product Docs", "description": "Internal product documentation" }'
# => { "id": "kb_abc123", "name": "Product Docs", "doc_count": 0 }
# 2. Ingest a document (up to 100KB per request, 1000 docs per KB)
curl -X POST https://agentdyne.com/api/rag/ingest \
-H "Authorization: Bearer agd_your_key" \
-H "Content-Type: application/json" \
-d '{
"knowledge_base_id": "kb_abc123",
"title": "Getting Started Guide",
"content": "## Installation\n\nnpm install @agentdyne/sdk…",
"chunk_size": 1200,
"chunk_overlap": 200
}'
# => { "document_id": "doc_xyz", "chunks_indexed": 8, "status": "indexed" }
# 3. Attach knowledge base to your agent (via Builder Studio or API)
curl -X PATCH https://agentdyne.com/api/agents/AGENT_ID \
-d '{ "knowledge_base_id": "kb_abc123" }'# Semantic retrieval — called by the execute route automatically when
# the agent has a knowledge_base_id attached. You can also call it directly:
curl -X POST https://agentdyne.com/api/rag/query \
-H "Authorization: Bearer agd_your_key" \
-H "Content-Type: application/json" \
-d '{
"knowledge_base_id": "kb_abc123",
"query": "How do I install the SDK?",
"top_k": 5,
"threshold": 0.65
}'
# Returns: { results: [{ content, document_title, similarity }], context_string }
# The context_string can be injected into an agent system prompt directly.// Agentic RAG — agent decides when to retrieve via tool calls
// Add this to your agent's system prompt:
const AGENTIC_SYSTEM_PROMPT = `
You are a knowledgeable assistant with access to a knowledge base tool.
When asked a question that requires specific factual information:
1. Call search_knowledge_base(query) to retrieve relevant context
2. Use the returned context to formulate an accurate answer
3. Cite the source document when referencing specific facts
4. If no relevant context is found, clearly state the knowledge base
does not contain information on this topic
Always prefer retrieved context over your training data for domain-specific questions.
`upsert_vectors and query from your system prompt. The built-in RAG API (pgvector) handles up to ~10M vectors efficiently.Agent Registry
Machine-readable agent discovery API — the 'DNS for agents'. Used by pipelines, orchestrators, and developer tooling to find the right agent by capability, cost, and quality.
/api/registryCapability-based agent discovery. Params: capabilities, category, input_type, output_type, max_cost, min_score, prefer (accuracy|speed|cost|balanced), limit.
/api/registry/{id}Full machine-readable agent schema: input_schema, output_schema, capability_tags, version history, seller.
# Machine-readable agent discovery — "DNS for agents"
# Find all agents that can summarise text in under $0.01/call
curl "https://agentdyne.com/api/registry?capabilities=summarize&max_cost=0.01&prefer=cost" \
-H "Authorization: Bearer agd_your_key"
# Response — machine-optimised (no UI cruft)
{
"agents": [
{
"id": "agent_abc",
"endpoint": "https://agentdyne.com/api/agents/agent_abc/execute",
"capability_tags": ["summarize","extract","classify"],
"pricing": { "model": "per_call", "price_per_call": 0.005 },
"quality": { "composite_score": 91.2, "accuracy_score": 94.1 }
}
],
"capability_graph": { "summarize": ["agent_abc", "agent_def"] },
"composition_hints": [
{ "chain": ["agent_abc","agent_def"], "compatible_on": ["text"] }
]
}
# Full schema for a specific agent (input/output schemas, versions, seller)
curl "https://agentdyne.com/api/registry/AGENT_ID"Credits API
Per-call and freemium agents deduct from your credit balance. Free agents and subscription agents do not use credits. Top up via Stripe Checkout.
/api/creditsBalance, hard_limit, alert_threshold, transaction history. Params: page, limit.
/api/creditsCreate Stripe Checkout session to top up. Body: { package_id }. Returns { url }.
# Get current credit balance
curl https://agentdyne.com/api/credits \
-H "Authorization: Bearer agd_your_key"
# => { "balance": 12.50, "hard_limit": 50, "low_balance": false }
# Purchase credits (creates Stripe Checkout session)
curl -X POST https://agentdyne.com/api/credits \
-H "Authorization: Bearer agd_your_key" \
-d '{ "package_id": "credits_20" }'
# packages: credits_5 ($5), credits_20 ($22), credits_50 ($57), credits_100 ($120)
# => { "url": "https://checkout.stripe.com/…" }MCP Integrations
40+ verified MCP (Model Context Protocol) servers. Attach tools to any agent in Builder Studio → MCP Tools tab. Tools appear in the agent's execution context — reference them in your system prompt.
// Attach MCP tools to an agent via the Builder Studio or API:
// PUT /api/agents/AGENT_ID (PATCH the mcp_servers field)
// In your system prompt, reference the tools by name:
const SYSTEM_PROMPT = `
You have access to the following tools:
- GitHub: read repositories, create pull requests, manage issues
- Supabase: query tables, run SQL, fetch records
- Slack: send messages, read channels
When the user asks you to perform an action that requires one of these tools,
use the tool explicitly before responding. Always confirm the action was
completed successfully before reporting to the user.
`
// Available MCP servers in Builder Studio:
// databases: supabase, postgres, mysql, mongodb, redis
// communication: gmail, slack, twilio, discord
// productivity: google-calendar, notion, google-drive, linear, asana
// development: github, filesystem, browserbase, puppeteer
// cloud: aws, gcp, cloudflare, vercel
// ai: anthropic, openai, pinecone, qdrant
// finance: stripe, plaid
// marketing: hubspot, salesforceWebhooks
Real-time events pushed to your HTTPS endpoint. Register URLs in Settings → Webhooks. All events are HMAC-SHA256 signed.
// Register a webhook URL in Settings → Webhooks
// Every event is signed with HMAC-SHA256 in X-AgentDyne-Signature
// Next.js App Router handler:
export async function POST(req: Request) {
const sig = req.headers.get("x-agentdyne-signature") ?? ""
const body = await req.text()
// Verify signature (prevents spoofed events)
const expected = await computeHmac(process.env.AGENTDYNE_WEBHOOK_SECRET!, body)
if (sig !== expected) return new Response("Unauthorized", { status: 401 })
const event = JSON.parse(body)
switch (event.type) {
case "execution.completed": await onExecutionDone(event.data); break
case "execution.failed": await onExecutionFailed(event.data); break
case "agent.approved": await onAgentApproved(event.data); break
case "payout.processed": await recordPayout(event.data); break
}
return Response.json({ received: true })
}
// Event types:
// execution.completed | execution.failed
// agent.approved | agent.rejected
// subscription.created | subscription.updated | subscription.canceled
// payout.processed | review.posted | credits.lowRate Limits
Limits apply per API key and scale with your plan.
| Plan | Calls/month | Req/min | Concurrency |
|---|---|---|---|
| Free | 50 lifetime | 3 | 1 |
| Starter | 500 | 10 | 3 |
| Pro | 5,000 | 30 | 10 |
| Enterprise | Unlimited | 200 | 50 |
Error Codes
Standard HTTP codes plus AgentDyne machine-readable codes.
Bad Request
ValidationErrorMissing or invalid parameters. Check agentId format and body JSON.
Unauthorized
AuthenticationErrorMissing, invalid, or revoked API key.
Payment Required
InsufficientCreditsErrorCredit balance below agent price (INSUFFICIENT_CREDITS).
Forbidden
SubscriptionRequiredErrorAgent requires subscription (SUBSCRIPTION_REQUIRED) or PLAN_RESTRICTION.
Email Not Verified
EMAIL_NOT_VERIFIEDVerify your email before running agents.
Account Banned
AccountBannedAccount suspended — contact support@agentdyne.com.
Not Found
NotFoundErrorAgent, pipeline, or resource does not exist.
Payload Too Large
InputTooLargeInput exceeds 32KB limit for your plan.
Content Policy
CONTENT_POLICYInput blocked by safety guardrails. See blocked_by field.
Quota Exceeded
QUOTA_EXCEEDEDMonthly execution quota reached. Upgrade or wait for next billing cycle.
Lifetime Limit
LIFETIME_QUOTA_EXCEEDEDFree plan 50-execution lifetime limit reached. Upgrade to Starter.
Compute Cap
COMPUTE_CAP_EXCEEDEDMonthly USD compute cap reached ($10 Starter / $50 Pro). Upgrade for higher cap.
Concurrency Limit
CONCURRENCY_LIMITToo many simultaneous executions. Free=1, Starter=3, Pro=10.
Rate Limit
RateLimitErrorToo many requests per minute. Retry-After header contains wait seconds.
Server Error
InternalServerErrorAgentDyne error. Retry with exponential back-off. ExecutionId is preserved for retry.
// Every error response has this shape:
{
"error": "Human-readable message",
"code": "MACHINE_READABLE_CODE", // e.g. QUOTA_EXCEEDED, INSUFFICIENT_CREDITS
"retryAfter": 60 // only on 429
}
// Common codes:
// QUOTA_EXCEEDED — monthly call limit reached; upgrade plan
// INSUFFICIENT_CREDITS — balance < agent price; top up at /billing
// SUBSCRIPTION_REQUIRED — agent requires active subscription
// INJECTION_BLOCKED — input rejected by security filter
// AGENT_NOT_CONFIGURED — system prompt missing or too short