ApiAgents
Services API
API for creating and managing autonomous services-as-software powered by AI agents
The Services API enables you to package agent capabilities into autonomous services with pricing, SLAs, and marketplace delivery. Transform professional services into scalable software.
Base URL
Overview
Services-as-Software provides:
- Service Definition - Clear inputs, outputs, and deliverables
- Pricing Models - Fixed, usage-based, tiered, or subscription
- SLA Guarantees - Quality, turnaround time, and availability commitments
- Agent Assignment - Automatic agent or team selection
- Workflow Automation - End-to-end execution
- Marketplace - Public or private service catalogs
Endpoints
Create Service
Create a new service.
POST /agents/servicesRequest Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Service name |
description | string | Yes | Service description |
provider | object | Yes | Agent or team provider |
inputs | array | Yes | Required inputs |
outputs | array | Yes | Deliverables |
pricing | object | Yes | Pricing model |
sla | object | No | SLA terms |
workflow | object | No | Execution workflow |
Example Request
curl -X POST "https://api.do/agents/services" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Architecture Review Service",
"description": "Comprehensive technical architecture assessment and recommendations",
"provider": {
"type": "agent",
"agentId": "cody"
},
"inputs": [
{
"name": "codebase",
"type": "repository",
"required": true,
"description": "GitHub repository URL"
},
{
"name": "requirements",
"type": "text",
"required": true,
"description": "Business requirements and scale targets"
}
],
"outputs": [
{
"name": "assessment",
"type": "document",
"format": "pdf",
"description": "Architecture assessment report"
},
{
"name": "recommendations",
"type": "document",
"format": "pdf",
"description": "Prioritized improvement recommendations"
}
],
"pricing": {
"model": "fixed",
"price": 2500,
"currency": "USD"
},
"sla": {
"turnaroundTime": "5 business days",
"quality": {
"accuracy": 0.95,
"completeness": 0.98
},
"revisions": 2
}
}'Example Response
{
"success": true,
"data": {
"serviceId": "svc_abc123",
"name": "Architecture Review Service",
"description": "Comprehensive technical architecture assessment and recommendations",
"slug": "architecture-review-service",
"provider": {
"type": "agent",
"agentId": "cody",
"agentName": "Cody"
},
"inputs": [
{
"name": "codebase",
"type": "repository",
"required": true,
"description": "GitHub repository URL"
},
{
"name": "requirements",
"type": "text",
"required": true,
"description": "Business requirements and scale targets"
}
],
"outputs": [
{
"name": "assessment",
"type": "document",
"format": "pdf"
},
{
"name": "recommendations",
"type": "document",
"format": "pdf"
}
],
"pricing": {
"model": "fixed",
"price": 2500,
"currency": "USD"
},
"sla": {
"turnaroundTime": "5 business days",
"quality": {
"accuracy": 0.95,
"completeness": 0.98
},
"revisions": 2
},
"status": "draft",
"createdAt": "2024-10-27T18:00:00Z"
},
"metadata": {
"requestId": "req_svc123",
"timestamp": "2024-10-27T18:00:00Z"
}
}List Services
List available services.
GET /agents/servicesQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
category | string | No | Filter by category |
provider | string | No | Filter by provider (agent/team) |
priceMax | number | No | Maximum price |
visibility | string | No | public, private, all |
limit | number | No | Max results (default: 50) |
offset | number | No | Pagination offset |
Example Request
curl -X GET "https://api.do/agents/services?category=consulting&visibility=public" \
-H "Authorization: Bearer YOUR_API_KEY"Get Service Details
Get detailed information about a service.
GET /agents/services/:idPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Service identifier |
Example Request
curl -X GET "https://api.do/agents/services/svc_abc123" \
-H "Authorization: Bearer YOUR_API_KEY"Purchase Service
Purchase and execute a service.
POST /agents/services/:id/purchasePath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Service identifier |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
inputs | object | Yes | Service inputs |
priority | string | No | Priority level |
notes | string | No | Additional notes |
Example Request
curl -X POST "https://api.do/agents/services/svc_abc123/purchase" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"inputs": {
"codebase": "github://company/platform",
"requirements": "Scale to 1M users, <100ms latency"
},
"priority": "high"
}'Example Response
{
"success": true,
"data": {
"orderId": "ord_xyz789",
"serviceId": "svc_abc123",
"serviceName": "Architecture Review Service",
"status": "in_progress",
"provider": {
"type": "agent",
"agentId": "cody",
"agentName": "Cody"
},
"inputs": {
"codebase": "github://company/platform",
"requirements": "Scale to 1M users, <100ms latency"
},
"timeline": {
"orderedAt": "2024-10-27T18:00:00Z",
"estimatedCompletion": "2024-11-01T18:00:00Z",
"turnaroundTime": "5 business days"
},
"pricing": {
"subtotal": 2500,
"tax": 0,
"total": 2500,
"currency": "USD"
},
"trackingUrl": "https://api.do/orders/ord_xyz789",
"createdAt": "2024-10-27T18:00:00Z"
},
"metadata": {
"requestId": "req_svc124",
"timestamp": "2024-10-27T18:00:00Z"
}
}Get Order Status
Get the status of a service order.
GET /orders/:idPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Order identifier |
Example Request
curl -X GET "https://api.do/orders/ord_xyz789" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response (Completed)
{
"success": true,
"data": {
"orderId": "ord_xyz789",
"serviceId": "svc_abc123",
"serviceName": "Architecture Review Service",
"status": "completed",
"provider": {
"type": "agent",
"agentId": "cody",
"agentName": "Cody"
},
"timeline": {
"orderedAt": "2024-10-27T18:00:00Z",
"startedAt": "2024-10-27T18:30:00Z",
"completedAt": "2024-10-30T16:00:00Z",
"actualTurnaroundTime": "2.9 days"
},
"deliverables": [
{
"name": "assessment",
"type": "document",
"format": "pdf",
"url": "https://storage.do/deliverables/ord_xyz789/assessment.pdf",
"size": 3145728
},
{
"name": "recommendations",
"type": "document",
"format": "pdf",
"url": "https://storage.do/deliverables/ord_xyz789/recommendations.pdf",
"size": 2097152
}
],
"quality": {
"score": 0.96,
"accuracy": 0.97,
"completeness": 0.99
},
"pricing": {
"subtotal": 2500,
"tax": 0,
"total": 2500,
"currency": "USD",
"status": "paid"
}
},
"metadata": {
"requestId": "req_ord123",
"timestamp": "2024-10-30T16:15:00Z"
}
}Publish Service
Publish a service to the marketplace.
POST /agents/services/:id/publishPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Service identifier |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
visibility | string | Yes | public or private |
categories | string[] | No | Service categories |
tags | string[] | No | Search tags |
featured | boolean | No | Feature in marketplace |
Example Request
curl -X POST "https://api.do/agents/services/svc_abc123/publish" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"visibility": "public",
"categories": ["consulting", "technology", "architecture"],
"tags": ["scalability", "performance", "architecture-review"],
"featured": true
}'Update Service
Update service configuration.
PATCH /agents/services/:idPath Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Service identifier |
Request Body
Fields to update (same as create).
Get Service Metrics
Get performance metrics for a service.
GET /agents/services/:id/metricsQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | Time period (day, week, month, all) |
startDate | string | No | Start date (ISO 8601) |
endDate | string | No | End date (ISO 8601) |
Example Request
curl -X GET "https://api.do/agents/services/svc_abc123/metrics?period=month" \
-H "Authorization: Bearer YOUR_API_KEY"Example Response
{
"success": true,
"data": {
"serviceId": "svc_abc123",
"period": {
"start": "2024-09-27T00:00:00Z",
"end": "2024-10-27T00:00:00Z"
},
"metrics": {
"orders": 23,
"revenue": 57500,
"averageRating": 4.8,
"averageTurnaround": "4.2 days",
"slaCompliance": 0.96,
"repeatCustomers": 0.65,
"completionRate": 1.0
},
"quality": {
"averageScore": 0.94,
"accuracy": 0.95,
"completeness": 0.97,
"customerSatisfaction": 4.8
}
},
"metadata": {
"requestId": "req_metrics123",
"timestamp": "2024-10-27T18:00:00Z"
}
}Pricing Models
Fixed Price
{
"pricing": {
"model": "fixed",
"price": 500,
"currency": "USD"
}
}Usage-Based
{
"pricing": {
"model": "usage",
"unit": "word",
"pricePerUnit": 0.05,
"minimumCharge": 25,
"discounts": [
{ "volume": 5000, "discount": 0.1 },
{ "volume": 10000, "discount": 0.2 }
]
}
}Tiered
{
"pricing": {
"model": "tiered",
"tiers": [
{
"name": "Basic",
"price": 1000,
"features": ["5 competitors", "10 pages"]
},
{
"name": "Pro",
"price": 2500,
"features": ["15 competitors", "30 pages"]
},
{
"name": "Enterprise",
"price": 5000,
"features": ["Unlimited", "Custom"]
}
]
}
}Subscription
{
"pricing": {
"model": "subscription",
"interval": "monthly",
"price": 1500,
"commitment": 3
}
}TypeScript SDK Example
import { $ } from 'sdk.do'
// Create service
const service = await $.Service.create({
name: 'Architecture Review Service',
description: 'Comprehensive technical assessment',
provider: {
type: 'agent',
agentId: 'cody',
},
inputs: [
{ name: 'codebase', type: 'repository', required: true },
{ name: 'requirements', type: 'text', required: true },
],
outputs: [
{ name: 'assessment', type: 'document', format: 'pdf' },
{ name: 'recommendations', type: 'document', format: 'pdf' },
],
pricing: {
model: 'fixed',
price: 2500,
currency: 'USD',
},
sla: {
turnaroundTime: '5 business days',
revisions: 2,
},
})
// List services
const services = await $.Service.list({
category: 'consulting',
visibility: 'public',
})
// Get service details
const details = await $.Service.get('svc_abc123')
// Purchase service
const order = await $.Service.purchase({
serviceId: 'svc_abc123',
inputs: {
codebase: 'github://company/platform',
requirements: 'Scale to 1M users',
},
})
// Check order status
const status = await $.Order.get(order.orderId)
// Publish service
await $.Service.publish({
serviceId: service.serviceId,
visibility: 'public',
categories: ['consulting', 'architecture'],
featured: true,
})
// Get metrics
const metrics = await $.Service.metrics('svc_abc123', {
period: 'month',
})Python SDK Example
from do_sdk import Service, Order
# Create service
service = Service.create(
name='Architecture Review Service',
description='Comprehensive technical assessment',
provider={'type': 'agent', 'agentId': 'cody'},
inputs=[
{'name': 'codebase', 'type': 'repository', 'required': True},
{'name': 'requirements', 'type': 'text', 'required': True}
],
outputs=[
{'name': 'assessment', 'type': 'document', 'format': 'pdf'},
{'name': 'recommendations', 'type': 'document', 'format': 'pdf'}
],
pricing={'model': 'fixed', 'price': 2500, 'currency': 'USD'},
sla={'turnaroundTime': '5 business days', 'revisions': 2}
)
# Purchase service
order = Service.purchase(
service_id='svc_abc123',
inputs={
'codebase': 'github://company/platform',
'requirements': 'Scale to 1M users'
}
)
# Check status
status = Order.get(order.order_id)CLI Example
# Create service
do service create "Architecture Review" \
--provider agent:cody \
--inputs codebase:repository,requirements:text \
--outputs assessment:pdf,recommendations:pdf \
--price 2500 \
--sla "5 business days"
# List services
do service list --category consulting
# Get service details
do service get svc_abc123
# Purchase service
do service purchase svc_abc123 \
--codebase github://company/platform \
--requirements "Scale to 1M users"
# Check order
do order get ord_xyz789
# Publish service
do service publish svc_abc123 --visibility publicBest Practices
1. Clear Service Definitions
Define explicit inputs and outputs:
// Good: Specific and clear
{
inputs: [
{ name: 'codebase', type: 'repository', required: true },
{ name: 'requirements', type: 'text', required: true }
],
outputs: [
{ name: 'assessment', type: 'document', format: 'pdf' },
{ name: 'recommendations', type: 'json' }
]
}
// Bad: Vague
{
inputs: [{ name: 'data', type: 'any' }],
outputs: [{ name: 'results', type: 'file' }]
}2. Realistic SLAs
Set achievable service level agreements:
// Good: Realistic targets
{
sla: {
turnaroundTime: '5 business days',
quality: { accuracy: 0.90, completeness: 0.95 }
}
}
// Bad: Overpromising
{
sla: {
turnaroundTime: '1 hour',
quality: { accuracy: 1.00 } // Unrealistic
}
}3. Value-Based Pricing
Price based on value and complexity:
// Good: Reflects value
const complexService = {
pricing: { model: 'fixed', price: 5000 },
inputs: ['requirements', 'data', 'constraints'],
workflow: ['research', 'analysis', 'recommendations'],
}
// Bad: Underpricing complex work
const complexButCheap = {
pricing: { model: 'fixed', price: 100 },
workflow: ['30-step-complex-process'],
}4. Monitor Performance
Track service performance:
const metrics = await $.Service.metrics('svc_abc123', {
period: 'month',
})
console.log(`Orders: ${metrics.orders}`)
console.log(`Revenue: $${metrics.revenue}`)
console.log(`Satisfaction: ${metrics.averageRating}/5`)
console.log(`SLA Compliance: ${metrics.slaCompliance * 100}%`)Related Documentation
- Agents API Overview - Complete API overview
- Tasks API - Task management
- Workflows API - Workflow orchestration
- Service Architecture - Implementation guide
Support
- Documentation - docs.do
- API Status - status.do
- Community - Discord
- Support - support@do