Skip to main content

Execute Agent

Execute an agent with custom variables.

Endpoint

POST /api/v1/agents/{agentId}/execute

Authentication

Requires API key in Authorization header:

Authorization: Bearer pk_live_YOUR_API_KEY

Request Body

{
"variables": {
"variable_name": "value",
"another_variable": "another value"
}
}

Parameters

FieldTypeRequiredDescription
variablesobjectYesKey-value pairs of variables required by the agent

Response

Success (200)

{
"jobId": "550e8400-e29b-41d4-a716-446655440000",
"status": "queued",
"agentId": "agent_123",
"message": "Agent execution queued successfully"
}
FieldTypeDescription
jobIdstringUnique execution ID - use to check status
statusstringqueued | processing | completed | failed
agentIdstringAgent that was executed
messagestringHuman-readable status message

Error Responses

Missing Variables (400)

{
"error": "Missing required variables",
"missingVariables": ["product_name", "features"]
}

Invalid API Key (401)

{
"error": "Invalid or revoked API key"
}

Agent Not Found (404)

{
"error": "Agent not found",
"message": "Agent agent_123 does not exist"
}

Rate Limit Exceeded (429)

{
"error": "Rate limit exceeded",
"retryAfter": 45,
"rateLimits": {
"requestsPerMinute": 100
}
}

Example Request

curl -X POST https://api.promptick.ai/api/v1/agents/agent_abc123/execute \
-H "Authorization: Bearer pk_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"variables": {
"product_name": "Smart Watch Pro",
"target_audience": "fitness enthusiasts",
"tone": "energetic"
}
}'

Checking Execution Status

Use the returned jobId to check status:

GET /api/v1/agents/{agentId}/executions/{executionId}

Learn more →

Next Steps