Skip to main content

Agents API

The Agents API allows you to execute AI agents programmatically. Agents can operate in different modes to help with various tasks.

Base URL

https://dreamsolve.ai/api/v1

Authentication

All endpoints require authentication via the x-api-key header. See the API Overview for details.


Execute Agent

Execute an agent with the specified parameters.

POST /api/v1/agents/:agentId/execute

Path Parameters

ParameterTypeDescription
agentIdstringThe agent ID to execute

Request Body

{
"mode": "conversational",
"userInput": "Help me plan my project",
"nodeId": "123",
"conversationId": "conv_456"
}
FieldTypeRequiredDescription
modestringNoExecution mode: conversational or node-assignment (default: conversational)
userInputstringYesThe user's input or prompt
nodeIdstringConditionalRequired for node-assignment mode
conversationIdstringNoContinue an existing conversation

Execution Modes

ModeDescription
conversationalGeneral conversation with the agent
node-assignmentAgent works on a specific node (requires nodeId)

Response

{
"executionId": "exec_789",
"status": "completed",
"output": "Here's my analysis of your project..."
}
FieldTypeDescription
executionIdstringUnique execution identifier
statusstringExecution status
outputstringAgent's response (if completed)
errorstringError message (if failed)

Get Execution Status

Check the status of an agent execution.

GET /api/v1/agents/executions/:executionId

Path Parameters

ParameterTypeDescription
executionIdstringThe execution ID

Response

{
"executionId": "exec_789",
"agentId": "agent_123",
"status": "completed",
"output": "Agent response...",
"startedAt": "2024-01-15T10:00:00Z",
"completedAt": "2024-01-15T10:00:05Z"
}

Execution Status Values

StatusDescription
pendingExecution queued
runningAgent is processing
completedExecution finished successfully
failedExecution encountered an error

Import Agent

Import an agent configuration.

POST /api/v1/agents/import

Request Body

{
"name": "Custom Agent",
"description": "My custom AI agent",
"model": "claude-3-sonnet",
"config": {},
"prompt_template": "You are a helpful assistant..."
}

Response

{
"id": "agent_new",
"name": "Custom Agent",
"description": "My custom AI agent",
"created_at": "2024-01-15T10:00:00Z"
}

Status Code: 201 Created


Error Responses

Status CodeDescription
400Bad Request - Invalid parameters or missing required fields
401Unauthorized - Invalid or missing API key
404Not Found - Agent not found
500Internal Server Error

Example Error Response

{
"error": "userInput is required and must be a non-empty string"
}

Example Usage

Execute a conversational agent

curl -X POST \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "conversational",
"userInput": "What are the best practices for project planning?"
}' \
https://dreamsolve.ai/api/v1/agents/agent_123/execute

Execute an agent on a specific node

curl -X POST \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"mode": "node-assignment",
"userInput": "Analyze this task and suggest subtasks",
"nodeId": "task_456"
}' \
https://dreamsolve.ai/api/v1/agents/agent_123/execute