Skip to main content
POST
https://api.tracelm.ai
/
api
/
v1
/
tasks
/
{id}
/
detect
Run Detection
curl --request POST \
  --url https://api.tracelm.ai/api/v1/tasks/{id}/detect
{
  "loops": {},
  "failures": {},
  "context": {},
  "tool_matching": {}
}
Runs detection analysis on a task to identify loops, tool failures, and context issues.

Path Parameters

id
string
required
The task ID (UUID)

Response

loops
object
Loop detection results:
  • detected: Whether loops were detected
  • patterns: Number of loop patterns found
  • highest_severity: low, medium, or high
failures
object
Tool failure detection results:
  • total: Total number of failures
  • explicit: Explicit failures (errors returned)
  • semantic: Semantic failures (wrong results)
  • silent: Silent failures (no result)
  • status_mismatches: Status mismatch count
context
object
Context failure detection results:
  • total: Total context failures
  • forgotten_preferences: Count of forgotten user preferences
  • repeated_questions: Count of repeated questions
  • contradicted_facts: Count of contradicted facts
  • violated_constraints: Count of violated constraints
  • lost_context: Count of lost context instances
  • highest_severity: low, medium, or high
tool_matching
object
Tool result matching:
  • total_calls: Total tool calls
  • matched: Successfully matched
  • unmatched: Tool calls without results
  • orphaned_results: Results without matching calls

Example

curl -X POST "https://api.tracelm.ai/api/v1/tasks/550e8400-e29b-41d4-a716-446655440000/detect" \
  -H "X-API-Key: $TRACELM_API_KEY"

Response

{
  "loops": {
    "detected": true,
    "patterns": 2,
    "highest_severity": "medium"
  },
  "failures": {
    "total": 3,
    "explicit": 1,
    "semantic": 2,
    "silent": 0,
    "status_mismatches": 0
  },
  "context": {
    "total": 1,
    "forgotten_preferences": 1,
    "repeated_questions": 0,
    "contradicted_facts": 0,
    "violated_constraints": 0,
    "lost_context": 0,
    "highest_severity": "low"
  },
  "tool_matching": {
    "total_calls": 5,
    "matched": 4,
    "unmatched": 1,
    "orphaned_results": 0
  }
}
Detection is automatically run when you call task.complete(). Use this endpoint to run detection without completing the task.