Marks a task as completed. This automatically runs detection analysis and stores the results.
Path Parameters
Request Body
Whether the task completed successfully
Additional metadata to attach to the completed task
Response
Updated task status: completed
Completion timestamp (ISO 8601)
Detection results (same as /detect endpoint):
loops: Loop detection results
failures: Tool failure detection
context: Context failure detection
tool_matching: Tool result matching
Example
curl -X POST "https://api.tracelm.ai/api/v1/tasks/550e8400-e29b-41d4-a716-446655440000/complete" \
-H "X-API-Key: $TRACELM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"success": true,
"metadata": {
"outcome": "booking_confirmed"
}
}'
Response
{
"status": "completed",
"completed_at": "2024-01-15T10:31:00Z",
"detection": {
"loops": {
"detected": false,
"patterns": 0,
"highest_severity": null
},
"failures": {
"total": 0,
"explicit": 0,
"semantic": 0,
"silent": 0,
"status_mismatches": 0
},
"context": {
"total": 0,
"forgotten_preferences": 0,
"repeated_questions": 0,
"contradicted_facts": 0,
"violated_constraints": 0,
"lost_context": 0,
"highest_severity": null
},
"tool_matching": {
"total_calls": 3,
"matched": 3,
"unmatched": 0,
"orphaned_results": 0
}
}
}
When using the SDK with context managers or withTask(), completion is handled automatically. The detection results are returned in the task object.