Check Execution Status
Get the status and results of an agent execution.
Endpoint
GET /api/v1/agents/{agentId}/executions/{executionId}
Authentication
Requires API key in Authorization header:
Authorization: Bearer pk_live_YOUR_API_KEY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
agentId | string | The agent ID |
executionId | string | The executionId returned from the execute call |
Response
All responses return 200 OK. The shape depends on the current status.
Processing (in progress)
{
"executionId": "550e8400-e29b-41d4-a716-446655440000",
"agentId": "agent_123",
"status": "processing",
"percentage": 45,
"currentStep": "Calling model"
}
Completed
{
"executionId": "550e8400-e29b-41d4-a716-446655440000",
"agentId": "agent_123",
"status": "completed",
"percentage": 100,
"currentStep": "Processing",
"output": "Generated content here...",
"tokensUsed": 450,
"costUSD": 0.000045,
"latencyMs": 1250,
"executedAt": "2025-01-15T10:30:06Z"
}
Failed
{
"executionId": "550e8400-e29b-41d4-a716-446655440000",
"agentId": "agent_123",
"status": "failed",
"percentage": 30,
"currentStep": "Calling model",
"error": "Model timeout"
}
Response Fields
| Field | Type | Present when | Description |
|---|---|---|---|
executionId | string | Always | Execution identifier |
agentId | string | Always | Agent that was executed |
status | string | Always | processing, completed, or failed |
percentage | number | Always | Progress from 0 to 100 |
currentStep | string | Always | Human-readable current step |
output | string | status = completed | The generated agent output |
tokensUsed | number | status = completed | Total tokens consumed |
costUSD | number | status = completed | Execution cost in USD |
latencyMs | number | status = completed | End-to-end latency in milliseconds |
executedAt | string | status = completed | ISO 8601 timestamp of completion |
error | string | status = failed | Error message describing the failure |
Polling Example
async function pollForResult(agentId, executionId) {
const maxAttempts = 30;
const pollInterval = 2000; // 2 seconds
for (let i = 0; i < maxAttempts; i++) {
const response = await fetch(
`https://api.promptick.ai/api/v1/agents/${agentId}/executions/${executionId}`,
{
headers: {
Authorization: `Bearer ${process.env.PROMPTICK_API_KEY}`,
},
}
);
const data = await response.json();
if (data.status === 'completed') {
return data.output;
}
if (data.status === 'failed') {
throw new Error(data.error);
}
await new Promise(resolve => setTimeout(resolve, pollInterval));
}
throw new Error('Execution timeout');
}